From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4AB1F53F.8090805@maht0x0r.net> Date: Thu, 17 Sep 2009 09:37:19 +0100 From: matt User-Agent: Mozilla Thunderbird 1.0.6 (X11/20060326) MIME-Version: 1.0 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [9fans] awk help; not plan9 matter Topicbox-Message-UUID: 6f86225a-ead5-11e9-9d60-3106f5b1d025 sed 's/^([^ ]+ +)([^ ]+)/\1HELL/' >Hello, > >simple task. >I want to change the 2nd field on each line of a file, but preserve >the spacing of the lines. > >If I do > awk '{$2="hell"; print}' file >the field gets changed, but all the spacing of the lines is gone; i.e. >any space is now just ' ' like this: >1 3 4 8 >changes to >1 hell 4 8 >while I need >1 hell 4 8. > >Any help? >Thanks >Ruda > > >