Re: Sed or perl subsitutions - in place

2008-04-04 Thread Alexander Schrijver
sed 's/$OLD/$NEW/' $file -I know this will only search and replace but how do I do in in-place so that the file itself is modified.* sed -a 's/old/new/wfilename' filename It is explained in: cd /usr/share/doc/usd/15.sed/; make paper.txt; less paper.txt Why dont you use

Re: Sed or perl subsitutions - in place

2008-04-04 Thread Raimo Niskanen
On Fri, Apr 04, 2008 at 01:07:10AM -0700, Parvinder Bhasin wrote: I am writing up a script to automatically increment the serial number of bind dns zone file , but I am running across issues doing in place substitution with either sed or even perl for that matter. I can do this easily in

Re: Sed or perl subsitutions - in place

2008-04-04 Thread Almir Karic
On Fri, Apr 4, 2008 at 10:07 AM, Parvinder Bhasin [EMAIL PROTECTED] wrote: I am writing up a script to automatically increment the serial number of bind dns zone file , but I am running across issues doing in place substitution with either sed or even perl for that matter. I can do this

Re: Sed or perl subsitutions - in place

2008-04-04 Thread Stuart Henderson
On 2008-04-04, Parvinder Bhasin [EMAIL PROTECTED] wrote: OLD=`grep serial $file | awk '{print $1}'` NEW=$(($OLD + 1)) *perl -p -i -e 's/$OLD/$NEW/' $file hopefully the other posts should get you going, but beware! also search for the text 'serial' when you do the

Re: Sed or perl subsitutions - in place

2008-04-04 Thread rivo nurges
On Fri, Apr 04, 2008 at 01:07:10AM -0700, Parvinder Bhasin wrote: Hi! *perl -p -i -e 's/$OLD/$NEW/' $file --tried using perl but still the file didn't change with the incremented serial number sed 's/$OLD/$NEW/' $file -I know this will only search

Re: Sed or perl subsitutions - in place

2008-04-04 Thread folays
Parvinder Bhasin [EMAIL PROTECTED] writes: I am writing up a script to automatically increment the serial number of bind dns zone file , but I am running across issues doing in place substitution with either sed or even perl for that matter. I can do this easily in Linux but am having hard