0

I tried searching in here, but it's seems there is only commands that helps to delete blank lines in text file.

Is there a linux bash script that I can execute to delete blank lines in any text file I want ?

MayWheather
  • 476
  • 5
  • 18
  • Sine you have found the commands that helps to delete blank lines, you can now create your own bash script by inserting those commands to the bash file. Simply copy the command that works into the file, then run chmod +x to make the file executable. Now you can execute the bash file – taari Oct 20 '18 at 16:50
  • 2
    Possible duplicate of [How to remove blank lines from a Unix file](https://stackoverflow.com/questions/14570489/how-to-remove-blank-lines-from-a-unix-file) –  Oct 21 '18 at 01:16

1 Answers1

1

Replace file.txt with the name and path to your file and run this command in the shell:

sed -i '/^$/d' file.txt
Tim
  • 9,171
  • 33
  • 51