Mailinglist Archive: opensuse (2731 mails)
| < Previous | Next > |
Re: [SLE] ?program to replace text in text files
- From: Derek Fountain <derekfountain@xxxxxxxxxxx>
- Date: Fri, 22 Aug 2003 10:45:16 +0800
- Message-id: <200308221045.16988.derekfountain@xxxxxxxxxxx>
On Thursday 21 August 2003 23:40, James Philp wrote:
> 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.
As others have said, add the 'g' modifier to have the regex applied over all
the data in the line, instead of just the first hit.
> Btw, where do you learn these things from? I'm not a
> computer science major, so are there any quick intro's
> to perl?
The O'Reilly books are pretty much the definitive works on Perl; the camel
book in particular is excellent. There are thousands of online resources.
Start at http://www.perl.com and see where you end up.
You may have noticed that you got a number of answers to your question, all
using different utilities. If you want to learn to do things like your search
'n' replace thing yourself, I'd advise you learn Perl, and don't worry about
any of the others. In the maze of Unix text manipulating utilites like Perl,
sed, awk and others, Perl is the one and only thing you need.
--
> eatapple
core dump
> 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.
As others have said, add the 'g' modifier to have the regex applied over all
the data in the line, instead of just the first hit.
> Btw, where do you learn these things from? I'm not a
> computer science major, so are there any quick intro's
> to perl?
The O'Reilly books are pretty much the definitive works on Perl; the camel
book in particular is excellent. There are thousands of online resources.
Start at http://www.perl.com and see where you end up.
You may have noticed that you got a number of answers to your question, all
using different utilities. If you want to learn to do things like your search
'n' replace thing yourself, I'd advise you learn Perl, and don't worry about
any of the others. In the maze of Unix text manipulating utilites like Perl,
sed, awk and others, Perl is the one and only thing you need.
--
> eatapple
core dump
| < Previous | Next > |