Two Ways to Remove Blank Lines from a File in Bash February 26, 2014 Removing blank lines from a file is very simple in bash. Here are two ways in which this can be accomplished using “sed” and “grep” sed -i '/^$/d' filenamesed -i '/^$/d' filename and grep -v '^$' inputfile > outputfilegrep -v '^$' inputfile > outputfile Share This! Related posts: Remove White Spaces from Filesnames in Bash File Input Validation. MP3 to MP3 Player Uploader in Bash 10 Useful Find Command for Linux Users Tags:blank, grep, lines, removing, sed Related Posts Restoring dual boot after upgrading to Vista. Creating a Desktop Launcher in Ubuntu 11.10 MP3 to MP3 Player Uploader in Bash About The Author miatech Add a Comment Cancel reply Your email address will not be published.Comment Save my name, email, and website in this browser for the next time I comment.