From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <4AB1FB95.4070005@maht0x0r.net> Date: Thu, 17 Sep 2009 12:42:43 +0200 Message-ID: From: Rudolf Sykora To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [9fans] awk help; not plan9 matter Topicbox-Message-UUID: 6fddf930-ead5-11e9-9d60-3106f5b1d025 Ok. Thanks again. I think I've found what I need. (on lines of 'inpch' that contain 'TH' I change the field at position $pos to be $new, preserving spacing made of 'space's and/or tabs). If anyone comes up with sth. simpler... Ruda (The script is for 'rc', btw., so that the concatanation on the 3rd line work.) 9 awk ' /TH/ {n = split($0, spaces, /[^ ]+/); $'$pos'='$new'; line = ""; for(i = 1; i < n; i++) line = line spaces[i] $(i); line = line spaces[n]; print line; next;} {print} ' inpch