The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM



Thread: nawk & awk
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-01-2008
sd12 sd12 is offline
Registered User
 

Join Date: Aug 2006
Location: AR
Posts: 15
nawk & awk

###----------------------TEST FOR $ Value------------------------
sort $RTF 2>>$LOG | nawk -F\| '\
{
for( i=1; i<=NF; ) {
if( i == NF )
{
amt=substr($i,1,1) #$ value
if (amt == /^ *[0-9] /)
printf( "$%s\n", $i );
else
printf( "%s\n", $i );
}
else
printf( "%s|", $i );
i++;
}
}' >$RFF 2>>$LOG
###---------------------------------------------------------------

I need an actual $ symbol in front of the value that is stored in NF (last value after the pipe. I tried both awk & nawk & it would not give me the result.
Reply With Quote
Forum Sponsor