there are similar questions here but none matches my problem exactly.How do I remove only the first blank line from a file using sed?Let's say I haveabcAnd I wantabcAs output.
remove only the first blank line sed
sed
See the sed FAQ here:$ sed '0,/^$/{//d}' linesabcdNote this only removes truly empty lines, if you want to consider lines with whitespace you would use$ sed '0,/^[[:space:]]*$/{//d}' linesinstead.