Quantcast
Channel: How do I remove blank lines from files? - Ask Ubuntu
Browsing all 6 articles
Browse latest View live

Answer by mchid for How do I remove blank lines from files?

Sometimes the other commands will fail to remove blank lines if the lines contain a blank space. The following will remove all blank lines including lines that contain only blank spaces.grep -v...

View Article



Answer by Jaydin for How do I remove blank lines from files?

You can do this in the default Ubuntu Text Editor (gedit) by:Press Ctrl+H to open Find and ReplaceIn the 'Find' box, enter \n\n which signifies two new lines without text in-between them.In the...

View Article

Answer by Zombo for How do I remove blank lines from files?

You can use Vim in Ex mode:ex -sc v/./d -cx hosts/./ find non blank linesv invert selectiond deletex save and close

View Article

Answer by terdon for How do I remove blank lines from files?

Many ways:Use sed and edit the file in place. sudo sed -i -rn '/\S/p' /etc/hostsSame, but with Perl:sudo perl -i -ne 'print if /\S/' /etc/hostsNewer versions of GNU awk, in place again:sudo awk -i...

View Article

Answer by Maythux for How do I remove blank lines from files?

Using sedType the following command:sed '/^$/d' input.txt > output.txtUsing grepType the following command:grep -v '^$' input.txt > output.txt

View Article


How do I remove blank lines from files?

I have a file (hosts) with some lines without content, how do I remove that lines without content?

View Article
Browsing all 6 articles
Browse latest View live




Latest Images