Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grep records from text files

Status
Not open for further replies.

unixwhoopie

Programmer
May 6, 2003
45
US
We have records in a text file in the file format:

I only want to grep records where the last but one field is not null. How do I grep these records?

C~234~AS~~~~~~~~~40003~~ (I want to grep this line)
C~234~AS~~~~~~~~~~~~ (I dont want to grep this)
A~234~AS~~~~~~~~~40003~~ (I dont want to grep this line - It should always start with a 'C'))

How do I specify the grep comand? I appreciate your help.

Thanks.
 
sed -n -e '/^C.*[^~]~~$/p' myFile.txt

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top