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

Sed/AWK Question 1

Status
Not open for further replies.

smicro

MIS
Dec 26, 2002
281
US
I have a file which in the first field of a line list error codes. I needed to pull out the codes that were "11". My problem is some error codes are 1. Also in the other fields(2,3 etc) there are other numbers so grepping wouldnt work(I dont think) I came up with
for a in `awk '{print $1}' erroroutg1| sed -n '/11/p'`
to find 11 in the first column but how would I get it to print the entire line that contains 11. If I print $a I just get "11" but not the rest of the line because of my awk statement. Any help would be great. Thanks.
 
why not simply this ?
awk '$1==11' erroroutg1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi

I do not understand your problem. If the below codes are not solving your problem, please show some sample input and desired output.
Code:
sed -n '/^11[[:space:]]/p' erroroutg1
[gray]# or[/gray]
awk '$1==11' erroroutg1
[gray]# or[/gray]
grep -w "^11" erroroutg1

Feherke.
 
PHV that was exactly what I needed, thanks!

I needed
11 server name 01/27/2006 04:02:29 (system call failed)

What I was getting with my code was:
11
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top