If you insist to perform it inside geany
editor - You can use geany lineoperations plugin which add the Remove Empty Lines feature to geany
A simpler way might be - to treat the file as a regular text file, and remove the empty lines using command-line
tools (e.g. sed
)
Here You can see several examples how to remove empty line from a text file.
Using sed
:
sed '/^$/d' <input-file>
To delete all empty lines from a file called /tmp/data.txt, enter:
sed '/^$/d' /tmp/data.txt
To store output to another file use redirection operator:
sed '/^$/d' /tmp/data.txt > /tmp/output.txt
Note: Using
sed
to remove empty lines shouldn't change anything with the non-empty lines in fileNote: In order to modify the file in place you should use
sed
-i
flag:
sed -i '/^$/d' <input-file>
Example:
The original text file:
$ cat in.txt
This is a test
Linux rulez
Windows sucks
Ubuntu is good server disro
sed
output when running on the file:
$ sed '/^$/d' in.txt
This is a test
Linux rulez
Windows sucks
Ubuntu is good server disro
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments