Mailinglist Archive: opensuse (2731 mails)

< Previous Next >
Re: [SLE] ?program to replace text in text files
  • From: James Philp <linuxjames2003@xxxxxxxxx>
  • Date: Thu, 21 Aug 2003 08:40:23 -0700 (PDT)
  • Message-id: <20030821154023.58321.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
Thanks a lot. Brilliant little trick. However it only
does it for the first row of the data. So I just had
to execute the script over and over again until it
parsed the entire data set.

Btw, where do you learn these things from? I'm not a
computer science major, so are there any quick intro's
to perl?

thanks, james.

--- Derek Fountain <derekfountain@xxxxxxxxxxx> wrote:
> > Does anyone know of a (command line) program in
> SuSE
> > that allows you to replace all occurences of a
> certain
> > string in a text (CSV) file with another?
> >
> > I have a (huge) file which contains Matlab style
> 'NaN'
> > for missing data and I need to make it Gauss
> readable
> > by replacing all the 'NaN' with the symbol '.'.
> It's
> > too big to be loaded into an editor or excel etc.
>
> Using everyone's favourite swiss army chainsaw:
>
> perl -pi -e 's/NaN/\./' file.csv
>
> Take a backup first!
>
> --
> > eatapple
> core dump
>
>
> --
> Check the headers for your unsubscription address
> For additional commands send e-mail to
> suse-linux-e-help@xxxxxxxx
> Also check the archives at http://lists.suse.com
> Please read the FAQs: suse-linux-e-faq@xxxxxxxx
>
>


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

< Previous Next >
References