Re: Editing text file



On Fri, 17 Apr 2009 10:29:15 -0700, Bojan wrote:

Hi,

I want to change a version number in 4 text files. The 4 files are not
the same, but the changes will be the same. For example. I want to
change "version 1.0" to "version 1.1". The files do have more information
than this and that information should remain unchanged, and the location
of version 1.0 is not always the same in the file.

Is it possible to do this for all the files at once? If it is not, how
would u do it for one file at a time?


I'd use gsar (general search and replace -
<http://gnuwin32.sourceforge.net/packages/gsar.htm>), or an awk of sed
script. Being me, I'd actually do it with gawk:

for %A in (file list) do ( gawk "{gsub(/version 1.0/, \"version
1.1\");print $0}" %A > other_directory\%A)


--
T.E.D. (tdavis@xxxxxxx)




.



Relevant Pages

  • Re: Automatisierte TextVerarbeitung
    ... AWK - oder bessergesagt "awk" kam mir doch gleich irgendwie bekannt vor ... Einige kann man auch als exe fuer Windows beziehen ... Ich habe soeben ein altes mawk herausgekramt und ein mini-awk script, ... Betreff: Re: where are the binaries for GAWK? ...
    (microsoft.public.de.german.windowsxp.sonstiges)
  • Re: Need help correcting this Bash function
    ... >> Why is it better to write a bash script than a script that runs ... machines that don't have bash or other more recent shells installed and, ... I do use gawk instead of old awk. ...
    (comp.unix.shell)
  • Re: Geez - is Solaris /usr/bin/awk brain dead or what?
    ... >which you might want to test on your old script. ... gawk's --traditional option makes gawk support some of the stuff that ... The V7 awk did not. ...
    (comp.unix.solaris)
  • Re: Difference beetwen awk and gawk?
    ... I'm new to awk, I wrote a simple script using gawk, then change it to awk: ... 0602-533 Cannot find or open file afile.dat ...
    (comp.lang.awk)
  • Re: How to rewrite with awk?
    ... > I'm unfamiliar with tools such as sed & awk. ... Extract the string that matches a RE. ... This script will not only expand all the lines that say "include ... file) and not resetting ARGV(the tmp file), it then lets awk do any ...
    (comp.unix.shell)