FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 10-20-2011, 02:01 PM
Avi Greenbury
 
Default bash command

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??

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
 
Old 10-20-2011, 03:42 PM
Leo Jackson
 
Default 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
 
Old 10-20-2011, 05:31 PM
Doug
 
Default 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.

- --


|_|0|_| |
|_|_|0| "Heghlu'Meh QaQ jajVam" |
|0|0|0| -------- kuLa --------- |



What the heck is that, Klingon?
What does it mean? --doug

gpg --keyserver pgp.mit.edu --recv-keys 0xC100B4CA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


--
Blessed are the peacemakers...for they shall be shot at from both sides. --A. M. Greeley


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4EA05AE4.50006@optonline.net">http://lists.debian.org/4EA05AE4.50006@optonline.net
 
Old 10-20-2011, 05:44 PM
Raf Czlonka
 
Default bash command

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
 
Old 10-20-2011, 06:04 PM
kuLa
 
Default bash command

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 20/10/11 18:31, Doug wrote:

>> - --
>> |_|0|_| |
>> |_|_|0| "Heghlu'Meh QaQ jajVam" |
>> |0|0|0| -------- kuLa --------- |

> What the heck is that, Klingon?
> What does it mean? --doug

lol, yes it is :-)
http://www.google.co.uk/search?aq=f&gcx=c&sourceid=chrome&client=ubuntu&ch annel=cs&ie=UTF-8&q=Heghlu'Meh+QaQ+jajVam

- --

|_|0|_| |
|_|_|0| "Heghlu'Meh QaQ jajVam" |
|0|0|0| -------- kuLa --------- |

gpg --keyserver pgp.mit.edu --recv-keys 0xC100B4CA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJOoGKRAAoJEOqHloDBALTKWJUH/iYna3AChWLrVFkltdIN2nPe
oqXU78vrmZ4A+3iw8/R6FgPJVIlBhIrv7u0y13a+cYt9TBTsDP+a9uXKQHgoI3ft
gdXuD4ZviGsjmbsMVLO5Pj/JzMbcjVTbNQA6m4SrQyfjbnVaV0RKZ3X3CRRbauG7
9uRVtfRcTY6fYGTNQwBH3O2F1J34m42l7YzCs1Ow5CthBEKd8l MFCQYloz2vd7DZ
tAD/mKFEh8cqNXLC8ql+UObhzpeJ4SPZRWGTChfTyiF1rliEEFLId8 98UGJVGu1Q
jYxwPrRluaaSFA4aj/8hKm5YfU7mptfFMjM1GhKGdAYcFHMDYTbIA9IxIXCN2AA=
=cFRx
-----END PGP SIGNATURE-----


--
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
 
Old 10-21-2011, 06:32 PM
Harry Putnam
 
Default 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
 
Old 10-21-2011, 07:42 PM
Stefan Monnier
 
Default 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
 
Old 10-24-2011, 09:10 AM
Darac Marjal
 
Default 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
 

Thread Tools




All times are GMT. The time now is 08:43 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org