2009/9/17 yy <yiyu....@gmail.com>: > if you want to preserve white-space, you better forget about fields > and work with indexes on the string, match is your friend: > > % echo '1 3 4 8' | awk '{match($0, /[ \t]*[^ \t]+[ > \t]+/);a=RLENGTH+1;match(substr($0, a), /[ \t]/);print > substr($0,0,a-1) "hell" substr($0,RSTART+a)}' > 1 hell 4 8
Well, it's just so difficult for me to read this. :) Also, i don't see how to easily modify it to flexibly work for any (not known beforehand) column, as I need. Why do you think this is better than my final solution? > this is indeed a bit OT here, maybe next time you prefer trying in > #awk at freenode, where this kind of problems are welcomed I didn't know there is a separate channel for awk... Thanks Ruda