sganta
asked on
How can I remove blank lines from the file ?
Hi experts,
I have so many blank lines in the file.How can I remove those lines ?
I am using SunOS.
Thanks in Advance!
I have so many blank lines in the file.How can I remove those lines ?
I am using SunOS.
Thanks in Advance!
grep -v ^$ your_file > new_file
awk 'NF > 0 {print $0}'
this will return the rows that have something in it.
this will return the rows that have something in it.
urim's answer is better, as mine would print a line that had spaces etc. on it
Nice one, urim
Nice one, urim
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
thacsi, if that's what is wanted, then urim was the first to give a correct solution. Please change your answer to a comment, and allow sganta to decide which is the most useful.
ASKER
Hi Experts,
Thank you for all your help. Urim was the first to answer the question. So, I am giving points to him. Inany way
I will also give points to "thacsi" and "tfewster" for your help.
Lots of thanks
sganta
Thank you for all your help. Urim was the first to answer the question. So, I am giving points to him. Inany way
I will also give points to "thacsi" and "tfewster" for your help.
Lots of thanks
sganta
ASKER
I am sorry, by mistake I gave to thacsi, In any way I want to give points
to all of you. So I will give the points to urim and tfewster.
to all of you. So I will give the points to urim and tfewster.
Sqanta:
egrep -v "^$|^ *$|^\^I$" file
will remove null blank lines in parse 1, 1 to n spaces in parse 2 and tabs in parse 3. I tried it, it will work.
egrep -v "^$|^ *$|^\^I$" file
will remove null blank lines in parse 1, 1 to n spaces in parse 2 and tabs in parse 3. I tried it, it will work.