On 20/06/2005, at 10:51 AM, Tony Green wrote:
perl -i -pe 's/foo.bar/bar.foo/g;s/\r/\n/g' <filename(s)>

I was going to put some explanation in, but got to eager :-)

OK let's break that down:

perl - pretty obvious, runs the Perl interpreter

-p - says to perl, 'for every line in the file, do this...'
-i - says to perl, 'don't create backup copies'

-e - says 'run the next bit as if it's a script'

s/foo.bar/bar.foo/g;s/\r/\n/g : This is the bit that does the work

s// - the substitute command, The '/' are just separators
\r - a 'return'
\n - a 'newline
g - means 'global', ie for every ocurrance.

So, put that together, and it means 'substitute every foo.bar with bar.foo and every \r with \n'

--
Tony Green <[EMAIL PROTECTED]>

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to