Remove blank lines with grep

后端 未结 15 2028
后悔当初
后悔当初 2020-12-22 17:51

I tried grep -v \'^$\' in Linux and that didn\'t work. This file came from a Windows file system.

15条回答
  •  时光取名叫无心
    2020-12-22 18:19

    Do lines in the file have whitespace characters?

    If so then

    grep "\S" file.txt

    Otherwise

    grep . file.txt

    Answer obtained from: https://serverfault.com/a/688789

提交回复
热议问题