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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sed or grep help

Status
Not open for further replies.

chomps303

MIS
Sep 30, 2003
83
0
0
US
How can I fina line if filed 1 eq a P


if I do a grep "P" I will get 3 I only want to get the 2 that start with a P
ie:

"P","123","abc345","678" < Get this one
"S","194","abc345","678" < don't get this one
"S","123","abc345","P" < don't get this one
"P","789","abc345","678" < Get this one

Thanks
Brandt
 
One way:
awk -F',' '$1=="\"P\""' /path/to/input
Another way:
grep '^"P",' /path/to/input

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
sed -n -e '/^"P",/p' file.txt

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

Part and Inventory Search

Sponsor

Back
Top