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!

shell and nawk : parameters

Status
Not open for further replies.

loloman

Technical User
Oct 30, 2002
16
0
0
FR
Hi,
i have an error when i want to compare ${DC} to $1

#!/bin/ksh
DC=7
cat file | nawk -F \; '
{if (NF == 3) printf "'${VAL1}';'${VAL2}';'${VAL3}';\n" ;
else
if (NF == 7 && $5 == 1 && ${DC} => $1) printf $1";"$2";"$3";"$4";'$5';"$6";\
n" ;

when i replace ${DC} by the value 7, it's ok

#!/bin/ksh
DC=7
cat file | nawk -F \; '
{if (NF == 3) printf "'${VAL1}';'${VAL2}';'${VAL3}';\n" ;
else
if (NF == 7 && $5 == 1 && 7 => $1) printf $1";"$2";"$3";"$4";'$5';"$6";\
n" ;

where is the problem, please ?
 
Hi

Code:
#!/bin/ksh
DC=7
cat file |  nawk [red]-vDC=$DC[/red] -F \; '
{if (NF == 3) printf "'${VAL1}';'${VAL2}';'${VAL3}';\n" ;
else
if (NF == 7 && $5 == 1 && [red]DC[/red] => $1) printf $1";"$2";"$3";"$4";'$5';"$6";\
n" ;
By the way, what kind of operator is [tt]=>[/tt] ?

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top