I tried grep -v '^$' in Linux and that didn’t work. This file came from a Windows file system.
I tried grep -v ‘^$’ in Linux and that didn’t work. This file came
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try the following:
The
-eoption allows regex patterns for matching.The single quotes around
^$makes it work for Cshell. Other shells will be happy with either single or double quotes.UPDATE: This works for me for a file with blank lines or "all white space" (such as windows lines with
\r\nstyle line endings), whereas the above only removes files with blank lines and unix style line endings: