LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-25-2004, 03:59 PM   #1
ky-lab_rat
Member
 
Registered: Jan 2004
Posts: 44

Rep: Reputation: 15
Sed q?


how can I change config.version = "6" to cfg.ver = "7" in a .cfg file?


I tried
Code:
sed 's/config.version = "6"/cfg.ver  = "7"/g' /home/app/update.cfg
No luck! It's the string, that I think is killing me. It has quotes and spaces it. Any and all help is appreciated!
 
Old 10-25-2004, 07:57 PM   #2
mjrich
Senior Member
 
Registered: Dec 2001
Location: New Zealand
Distribution: Debian
Posts: 1,046

Rep: Reputation: 45
You'll need to use the regular expression term for a space, at the very least. This works for me... sed 's/config.version[[:space:]]=[[:space:]]"6"/cfg.ver = "7"/g' /home/app/update.cfg

A good guide to such things is the Sed FAQ, floating ubiquitousely around the net :)

Last edited by mjrich; 10-25-2004 at 08:03 PM.
 
Old 10-25-2004, 08:02 PM   #3
taltman
Member
 
Registered: Jun 2004
Posts: 41

Rep: Reputation: 15
ky's command works for me and mj's does not
i am using sed 4.0.9
 
Old 10-25-2004, 08:50 PM   #4
mjrich
Senior Member
 
Registered: Dec 2001
Location: New Zealand
Distribution: Debian
Posts: 1,046

Rep: Reputation: 45
I've been using GNU Sed v. 4.1.2 - taltman, does it work when you include the double square brackets...?
 
Old 10-26-2004, 12:45 AM   #5
taltman
Member
 
Registered: Jun 2004
Posts: 41

Rep: Reputation: 15
yes it does...i just copied it as was and didn't even think about the syntax

so both of them work for me now
 
Old 10-26-2004, 08:59 AM   #6
ky-lab_rat
Member
 
Registered: Jan 2004
Posts: 44

Original Poster
Rep: Reputation: 15
ARG!! I found out what my problem was.. I had it executing in the wrong shell in my script.. D'oh! They need to add a smile for slap in head!

Thank everyone for the help!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sed and escaping & in something like: echo $y | sed 's/&/_/g' prx Programming 7 02-04-2005 12:00 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 07:12 AM
Help with sed odious1 Linux - General 2 08-29-2003 11:52 AM
help with sed DavidPhillips Programming 3 08-11-2003 05:46 PM
sed.... BongFish Linux - Software 4 08-07-2003 10:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration