LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-02-2007, 07:24 PM   #1
TheEngineer
LQ Newbie
 
Registered: Oct 2006
Location: UK
Distribution: MacOS , Redhat
Posts: 17

Rep: Reputation: 0
Question I need some help with SED and/or GREP...


Hi

Basically, I have a text file with a short list of packages (rpms) that I want to install via 'yum', with each package-name separated by a newline:

package1
package2
package3
package4


I want to execute something like:

yum install `command X textfile`

where command is sed and/or grep, and X are the options required to replace each carriage return for a space, so that it effectively results in:

yum install package1 package2 package3 package4

Could somebody please reply with the correct command(s) to achieve the above.

Thanking you in advance.

Kind regards,

Jules

Last edited by TheEngineer; 02-02-2007 at 07:35 PM.
 
Old 02-02-2007, 08:17 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
something like
Code:
yum install `IFS='\n';cat file`
should do the trick ....
W/o sed or grep, though; hope that's not THAT important
to you? :}



Cheers,
Tink
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
diffrence between grep, sed, awk and egrep Fond_of_Opensource Linux - Newbie 3 08-18-2006 08:15 AM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 11:36 AM
How can I awk/sed/grep the IPs from the maillog? abefroman Programming 7 03-09-2006 10:22 AM
Simple Text Reformat (sed and grep) mikefazz Programming 2 08-31-2004 07:38 PM
sed & grep script? dolvmin Linux - Software 20 09-22-2003 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:31 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