Aug 13, 2004 #1 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
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
Aug 14, 2004 1 #2 PHV MIS Nov 8, 2002 53,708 FR 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 Upvote 0 Downvote
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
Aug 14, 2004 Thread starter #3 Michael42 Programmer Oct 8, 2001 1,454 US PHV, Perfect! Thanks for posting. -Michael42 Thanks, Michael42 Upvote 0 Downvote