Re: to replace a field of a line - help

From: spanda (spanda_at_cisco.com)
Date: 03/04/04


Date: Thu, 4 Mar 2004 18:59:27 +0530

Hi Stefan,

Thanks for ur reply.

Here the point is I don't know the content of the 4th field ie. good.
And I want to replace it directly with a new word.
How can I do that ?

Regards
Subrat

"Stefan Lagotzki" <lago20@gmx.de> wrote in message
news:c279nb$tf2$06$1@news.t-online.com...
> spanda <spanda@cisco.com>:
> > I want to replace a field of a line without knowing the content of the
> > field.
> > i.e if a line is "he is a good guy" and I want to replace the 4th field
> > (good) and the new line
> > should be "he is a nice guy".
>
> awk '{gsub(/good/,"nice",$4);print}' input.txt > output.txt
>
> Test:
>
> echo "he is a good guy" | awk '{gsub(/good/,"nice",$4);print}'
> he is a nice guy
>
> HTH,
> Stefan
>
> .
>



Relevant Pages

  • Re: Vba to read column of text
    ... Without knowing much about your text file, I'm going to say NO because the ... Dave ... >> HTH, ... >>> regards, ...
    (microsoft.public.word.vba.general)
  • Re: AW: [Full-Disclosure] no more public exploits
    ... An admin who chooses ... >to ignore these probabilities isn't looking at their job with the right ... "Knowing what you don't know is more ... Regards, ...
    (Full-Disclosure)
  • Re: ER to Relation Mapping question
    ... >> Thanks heaps for your help here Stefan, but I haven't quite got it yet. ... unless I include *ordernum as part of the key I ... When it says 'include as a foreign key' am I supposed to include it ...
    (comp.databases)
  • Re: Connecting Tables
    ... but hard to say if it's optimal without knowing more about how ... HTH; ... Amy ... > posistionID, shiftID, PositionName, DefaultTimeIn, etc. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Color Index
    ... >> xlautomatic - so it isn't necessarily the blackfont color. ... >> Regards, ... >> Tom Ogilvy ... >>> HTH ...
    (microsoft.public.excel.programming)