How to remove extra line at end of file

Oct 21, 2013 at 12:37 PM
Please help with command to replace extra line at end of file
Coordinator
Oct 22, 2013 at 12:42 AM
Hi,

To check if last line has only line break and remove it use:

Find Text: (\r\n|\n)\z
Use Regular Expression: True
Replace Text: <empty>

Please let me know if this works for you. If not, please provide example of the file that you would like to process and how it should look before and after.

Eric
Oct 23, 2013 at 10:43 AM
Hi,

Thanks for replying. But it doesn't works for me.

Sample File:
This is the first line of file
Details of file
<new line>
This is the last line of file
<new line at end of file>

Expected file:
This is the first line of file
Details of file
<new line>
This is the last line of file

Please let me know if any command can be used to know end of file and remove any extra line if exist.
Coordinator
Oct 23, 2013 at 11:13 AM
Hi,

Can u please attach the actual file which needs last linebreak removed.

Eric
Oct 24, 2013 at 5:41 AM
Hi,

I am not sure how to attach file to this site. I don't see any options.

Please let me know the procedure of same.


Thanks.
Coordinator
Oct 24, 2013 at 5:47 AM
Hey,

There doesn't seem to be easy way to do it in comments, unless u upload it to something like dropbox and include the link. Can you send me the file to:

eric at entechsolutions dot com.

Eric
Oct 25, 2013 at 5:09 AM
Hi,

I have send the files to the email mentioned. Please let me know if that helps and we are able to get solution.

Thanks.
Coordinator
Oct 25, 2013 at 2:36 PM
Hi,

Thank you for sending the files.

To remove multiple line breaks from the end of the file use regular expression:
(\r\n|\n)+\z

Eric