![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with dd command or maybe AFS problem | Anta | Shell Programming and Scripting | 0 | 08-25-2006 07:10 AM |
| SSH Problem auth problem | budrito | UNIX for Advanced & Expert Users | 1 | 03-17-2004 07:12 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Sir,
I'm new to awk programming, i have been stuck in a problem could you plz clear that for me. $ who > file1 #(say) $cat file1 (enter) uf146 xyz 1234 ge001 mmbm 999 mgu155 ooo0 7yh ge101 unix 1234 $vi awk1.prog awk -F " " ' BEGIN { print " Enter the user name " ; getline name < "-" ; } { while(name~$1) { print $0; # complete record exit; } }' file1 output: $bash awk1.prog Enter the user name : mgu155 ge101 unix 1234 $bash awk1.prog Enter the user name : ca123 ???? when no user ??? no output ??? // what we should do to promt no user exists -ANAND |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
seems that you have posted under the wrong umbrella ...
try this, Code:
nawk -F " " ' BEGIN { line=""; i=0; print "enter name: " ; getline name < "-"; }
{
while(name~$1)
{
i=1;
line=$0;
break;
}
}
END {
{
if( i > 0)
{
print line;
}
else
{
printf "%s not found\n", name;
}
}
}' file1
|
|||
| Google The UNIX and Linux Forums |