Aug 14, 2004 #1 Michael42 Programmer Oct 8, 2001 1,454 US Hello again awk fans, In a string that is say 10 characters in length, how can I retrieve the right 3 most characters? I am trying to emulate a right(string,n) function found in many languages. Thanks, Michael42
Hello again awk fans, In a string that is say 10 characters in length, how can I retrieve the right 3 most characters? I am trying to emulate a right(string,n) function found in many languages. Thanks, Michael42
Aug 15, 2004 1 #2 PHV MIS Nov 8, 2002 53,708 FR A starting point: echo "1234567890\nabcdefghij" | awk '{print substr($0,1+length($0)-3)}' 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
A starting point: echo "1234567890\nabcdefghij" | awk '{print substr($0,1+length($0)-3)}' Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
Aug 15, 2004 Thread starter #3 Michael42 Programmer Oct 8, 2001 1,454 US PHV, Once again - that was perfect. I was close but being new to awk I did not quite have the syntax correct. Thanks again for posting, Michael42 Thanks, Michael42 Upvote 0 Downvote
PHV, Once again - that was perfect. I was close but being new to awk I did not quite have the syntax correct. Thanks again for posting, Michael42 Thanks, Michael42