LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-01-2005, 03:41 PM   #1
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Rep: Reputation: 32
using sed


suppose that I have a file containing following contents

file1:
Code:
$var1=Hello
$var2=Hello2

rule1   $rulepath/myrul.rl
rule2   $rulepath/myrul1.rl
rule2   $rulepath/myrul2.rf
rule3   $rulepath/myrul3.rf
rule4   $rulepath/myrul4.rf
what parameters/switche I have to gave to sed command to make a new file that contains following contents

file2:
Code:
$var1=Hello
$var2=Hello2

rule1   myrul.rl
rule2   myrul1.rl
rule2   myrul2.rf
rule3   myrul3.rf
rule4   myrul4.rf
i.e;
root@localhost#: sed ?

what should be here in the question mark
 
Old 07-01-2005, 03:52 PM   #2
AdaHacker
Member
 
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

Rep: Reputation: 32
In other words, you just want to remove the "$rulepath/" parts? Easy:
Code:
sed 's/$rulepath\///' file1 > file2
Did you want a little more information on sed, or was that it? I ask because if your real problem is this simple, it would have been just as easy to do a search and replace in your favorite text editor.
 
Old 07-01-2005, 03:57 PM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
It would be:

sed 's/$rulepath\///' filename1 > filename2

Crap, it figures I step away for a minute or two someone would jump in with the answer..

Last edited by trickykid; 07-01-2005 at 06:28 PM.
 
Old 07-01-2005, 03:59 PM   #4
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
thanks
 
  


Reply



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 On
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-03-2005 11:00 PM
Sed q? ky-lab_rat Linux - Software 5 10-26-2004 07:59 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM
Help with sed odious1 Linux - General 2 08-29-2003 10:52 AM
help with sed DavidPhillips Programming 3 08-11-2003 04:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:05 PM.

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