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

How add input value to some varieble in awk program

Status
Not open for further replies.

gargamel100

Technical User
Oct 25, 2006
31
CZ
Hi all,

this is probably funny for some of you but I do not know what to do. I have
read b
awk -v $b;FS="|" '
$4 == "202" && $9 == $b && $15 == "106" {print $1 "0"962$9, "0"$11 " " $23} ' /temp/test/test.txt > test1.txt

I want to enter some value from keyboard and add it to varieble inside an awk program....in this case variable b,,,how use variable b in awk program

Thank you in advance
 
Hi

Code:
read b
 awk -v[red]b=[/red]$b;[red]-F[/red]"|" '
    $4 == "202" && $9 == [red]b[/red] && $15 == "106" {print $1 "0"962$9,  "0"$11 " " $23} ' /temp/test/test.txt > test1.txt

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top