Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Blank lines in File
Name: Ravi Choudhary Date: August 17, 2001 at 13:01:37 Pacific
Comment:
I have very big file, which contains almost alternate blank lines. Can anybody suggest me how to delete those lines? I don't want to go on individual lines to delete it.
Name: Grant Date: August 17, 2001 at 20:26:23 Pacific
Reply:
Try grep -v "^$" file_name This should tell grep to search for all lines not matching a line with nothing between the start ^ and the finish $
0
Response Number 2
Name: James Boothe Date: August 27, 2001 at 15:28:44 Pacific
Reply:
and redirect your output to a new file: grep -v "^$" oldfile > newfile That grep command will eliminate null lines, but to eliminate both null lines and lines containing only whitespace, do: awk 'NF>0' oldfile > newfile
Summary: I need more help on removing the first line of my file. I have tried both suggestions but both of them seems to extract the 1st line of my old file and places to a new file. I didn't exactly want that...
Summary: Raxit, You can try with this one also ... #!/bin/sh IFS=' ' for i in `cat data_file` do ### If you are matching the whole line. if [$i = "Something you are searching"] then echo "U found me" fi ~~~~~~...