hi all,
I'm trying to use substr(p,c,l) in awk but i'd like to have the 'position' argument count from the right end of the string instead of left end.
evidently, just putting a '-' sign in front of the number does not work. any ideas?
cheers,
kl
Try something like
nawk '{print(substr($0,length($0)-4,1))}' myfile
Which'll print the fifth character from the right hand side of each record (assume position is zero-indexed).
Cheers
ZB