> Hey guys,
>
> I want to create a script to change some words in some sonf files at
> the start up of the system...do you know the command in bash for
> search the word and replace it??
What's the problem you're aiming to solve? I'm rather hoping there's a
more elegant (and less error-prone) way of achieving the same without
sedding a conf(?) file on every boot.
--
Avi
--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
10-20-2011, 03:42 PM
Leo Jackson
bash command
Jesus,
I was just curious is it something that keeps getting changed or is this a one time change?
If you alter a conf and it was booted with old conf and it keeps changing back from your
new back to the old.
Then we will need more information if you alter a file that after boot comes back it is
a default override taking effect.
Regards,
Leo Jackson
From: Jesus arteche <chechu.linux@gmail.com>
To: ubuntu-server@lists.ubuntu.com
Sent: Thursday, October 20, 2011 4:29 AM
Subject: bash command
Hey guys,
I want to create *a script to change some words in some sonf files at the start up of the system...do you know the command in bash for search the word and replace it??
Thanks
--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
10-20-2011, 05:31 PM
Doug
bash command
On 10/20/2011 04:37 AM, kuLa wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 20/10/11 09:29, Jesus arteche wrote:
Hey guys,
I want to create a script to change some words in some sonf files at
the start up of the system...do you know the command in bash for search
the word and replace it??
Well, I don't know about bash command but I know about sed.
On Thu, Oct 20, 2011 at 06:31:16PM BST, Doug wrote:
> >|_|0|_| |
> >|_|_|0| "Heghlu'Meh QaQ jajVam" |
> >|0|0|0| -------- kuLa --------- |
>
> What the heck is that, Klingon?
> What does it mean? --doug
http://en.wikiquote.org/wiki/Klingon_proverbs
--
Raf
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20111020174429.GA29659@linuxstuff.pl">http://lists.debian.org/20111020174429.GA29659@linuxstuff.pl
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4EA06291.5000004@kulisz.net">http://lists.debian.org/4EA06291.5000004@kulisz.net
10-21-2011, 06:32 PM
Harry Putnam
bash command
Darac Marjal <mailinglist@darac.org.uk> writes:
> Sadly, this can't be done in-place, so you'll either need to use mv to
> replace /etc/conf.file with /etc/conf.file.new or repeat the loop (with
> no substitution) to copy /etc/conf.file.new into /etc/conf.file.
Maybe now with bash, but with perl it can be done in place quite
handily.
perl -i -pe 's/WORDS/REPLACEMENT/' my.conf
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87aa8uw5zy.fsf@newsguy.com">http://lists.debian.org/87aa8uw5zy.fsf@newsguy.com
10-21-2011, 07:42 PM
Stefan Monnier
bash command
> Sadly, this can't be done in-place, so you'll either need to use mv to
> replace /etc/conf.file with /etc/conf.file.new or repeat the loop (with
> no substitution) to copy /etc/conf.file.new into /etc/conf.file.
It can be done "inplace" with `rm' in place or `mv':
(rm /etc/conf.file;
while read line; do
echo ${line/old_word/new_word}
done >/etc/conf.file) </etc/conf.file
-- Stefan
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: jwvzkgucevp.fsf-monnier+gmane.linux.debian.user@gnu.org">http://lists.debian.org/jwvzkgucevp.fsf-monnier+gmane.linux.debian.user@gnu.org
10-24-2011, 09:10 AM
Darac Marjal
bash command
On Fri, Oct 21, 2011 at 03:42:36PM -0400, Stefan Monnier wrote:
> > Sadly, this can't be done in-place, so you'll either need to use mv to
> > replace /etc/conf.file with /etc/conf.file.new or repeat the loop (with
> > no substitution) to copy /etc/conf.file.new into /etc/conf.file.
>
> It can be done "inplace" with `rm' in place or `mv':
>
> (rm /etc/conf.file;
> while read line; do
> echo ${line/old_word/new_word}
> done >/etc/conf.file) </etc/conf.file
True, but that's using external tools. My point was that it's difficult
to do simply with bash (which is what the OP asked for). If you're
allowing the use of external tools, sed is much easier.
--
Darac Marjal
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20111024091007.GA6821@darac.org.uk">http://lists.debian.org/20111024091007.GA6821@darac.org.uk