unix - Trying to get first letter from first name in nawk script to html -
why line 17 not working (commented in code)?:
#!/bin/nawk -f begin { print "<html>" print "<body>" print " <table border=2>" print " <tr>" print " <th>name</th>" print " <th>username</th>" print " <th>email</th>" print " </tr>" } { print " <tr>" print " <td>" $2 " " $1"</td>" print " <td>"'{substr($1,1,1)}' "</td>" ###### line 17 print " <td>" $3 "</td>"
am allowed put statement in line 17? im trying first letter of first name.
the single quotes in line should removed. quoting allows shell parse substr , not want happen.
also command substr not substr.
print " <td>"'{substr($1,1,1)}' "</td>" ###### line 17
change to-:
print " <td>" substr($1,1,1) "</td>"
Comments
Post a Comment