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

SubStr() 1

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello,

I am trying learn awk to enhance my bourne shell scripts on Sun Solaris.

1. With Awk\Nawk does anyone have an example of using substr() function?

2. Can anyone share how to get input from a $VARIABLE rather than a file?





Thanks,

Michael42
 
Example like this ?
[tt]VARIABLE="1234567890\nabcdefghijklm"
echo "$VARIABLE" | awk '{print substr($0,6,4)}'[/tt]
6789
fghi

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV,

Perfect!

Thanks for posting. :)

-Michael42

Thanks,

Michael42
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top