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

substr syntax

Status
Not open for further replies.

fluxdemon

MIS
Nov 5, 2002
89
US
I've been bouncing around several different sites and still can find a working substr statement. $fl=substr($1,1,1) should grab the first letter but I get : syntax error at line 2 : `(' unexpected.

I am logged on a Solaris server.
 
Hi:

I'm assuming you want the awk substr to work:

f1=`echo "teststring"| nawk ' { f1= substr($0, 1, 1)
print f1 # should print t
} '`

regards,

Ed

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top