On Wed, Jun 24, 2009 at 11:15:10PM +0000, Joseph L. Casale wrote: > >What you've written is mostly incoherent and incomprehensible. > > heh, been a long day:) > > Actually I am using gawk "/string1/ && /string2/ { print substr( $1, length($1) - 1, length($1) ) }" > which gets me what I need, the last two characters of the first The final parameter to substr() isn't needed (and would only be "2" for what you wanted) > field of a specific match... Well, it's only printing the first field, not necessarily the field that matched. eg $ echo hello there everyone | awk '/there/ && /everyone/ { print substr($1,length($1)-1) }' lo You need to do $1 ~ /regex/ if you only want to test against the first field -- rgds Stephen