Prev: Anyone have Solaris 2.6 Media available (needed for a Sparcbook 3)
Next: GNOME session file documentation?
From: Michael Laajanen on 15 Jul 2010 12:05 Hi, I should not ask "can" always here more "how" I have a number of files that I like to look for the line `define SIM 0 and change it to `define SIM 1 How can I do that from a script? /michael
From: Chris Ridd on 15 Jul 2010 12:21 On 2010-07-15 17:05:51 +0100, Michael Laajanen said: > Hi, > > I should not ask "can" always here more "how" > > I have a number of files that I like to look for the line > > `define SIM 0 and change it to `define SIM 1 > > How can I do that from a script? Use sed? Personally I prefer using perl with its convenient in-place editing flag (-i): perl -pi -e 's/define SIM 0/define SIM 1/g' * -- Chris
From: Michael Laajanen on 15 Jul 2010 13:54 Hi, Chris Ridd wrote: > On 2010-07-15 17:05:51 +0100, Michael Laajanen said: > >> Hi, >> >> I should not ask "can" always here more "how" >> >> I have a number of files that I like to look for the line >> >> `define SIM 0 and change it to `define SIM 1 >> >> How can I do that from a script? > > Use sed? Personally I prefer using perl with its convenient in-place > editing flag (-i): > > perl -pi -e 's/define SIM 0/define SIM 1/g' * > Excellent :) whenever I use sed I always pipe to a new file and then copy it back to the original name this is much better. Can this be done with sed aswell? /michael
From: Lew Pitcher on 15 Jul 2010 14:42 On July 15, 2010 13:54, in comp.unix.solaris, michael_laajanen(a)yahoo.com wrote: > Hi, > > Chris Ridd wrote: >> On 2010-07-15 17:05:51 +0100, Michael Laajanen said: >> >>> Hi, >>> >>> I should not ask "can" always here more "how" >>> >>> I have a number of files that I like to look for the line >>> >>> `define SIM 0 and change it to `define SIM 1 >>> >>> How can I do that from a script? >> >> Use sed? Personally I prefer using perl with its convenient in-place >> editing flag (-i): >> >> perl -pi -e 's/define SIM 0/define SIM 1/g' * >> > Excellent :) whenever I use sed I always pipe to a new file and then > copy it back to the original name this is much better. Can this be done > with sed aswell? GNU sed offers the -i and --in-place options, which cause sed to apply the edit changes directly to the file. However, it appears that these options are GNU extensions, and not part of the POSIX/SUS sed. -- Lew Pitcher Master Codewright & JOAT-in-training | Registered Linux User #112576 Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/ ---------- Slackware - Because I know what I'm doing. ------
From: Michael Laajanen on 15 Jul 2010 17:19 Hi, Lew Pitcher wrote: > On July 15, 2010 13:54, in comp.unix.solaris, michael_laajanen(a)yahoo.com > wrote: > >> Hi, >> >> Chris Ridd wrote: >>> On 2010-07-15 17:05:51 +0100, Michael Laajanen said: >>> >>>> Hi, >>>> >>>> I should not ask "can" always here more "how" >>>> >>>> I have a number of files that I like to look for the line >>>> >>>> `define SIM 0 and change it to `define SIM 1 >>>> >>>> How can I do that from a script? >>> Use sed? Personally I prefer using perl with its convenient in-place >>> editing flag (-i): >>> >>> perl -pi -e 's/define SIM 0/define SIM 1/g' * >>> >> Excellent :) whenever I use sed I always pipe to a new file and then >> copy it back to the original name this is much better. Can this be done >> with sed aswell? > > GNU sed offers the -i and --in-place options, which cause sed to apply the > edit changes directly to the file. > > However, it appears that these options are GNU extensions, and not part of > the POSIX/SUS sed. > Okey, I stick to perl. BTW, who said this NG was dead, it took only a couple of minutes... :) /michael
|
Next
|
Last
Pages: 1 2 Prev: Anyone have Solaris 2.6 Media available (needed for a Sparcbook 3) Next: GNOME session file documentation? |