Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-02-2007, 08:24 PM   #1
LQ Newbie
Registered: Oct 2006
Location: UK
Distribution: RHEL4
Posts: 12

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


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:


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,


Last edited by TheEngineer; 02-02-2007 at 08:35 PM.
Old 02-02-2007, 09:17 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,047
Blog Entries: 11

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



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
diffrence between grep, sed, awk and egrep Fond_of_Opensource Linux - Newbie 3 08-18-2006 09:15 AM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 12:36 PM
How can I awk/sed/grep the IPs from the maillog? abefroman Programming 7 03-09-2006 11:22 AM
Simple Text Reformat (sed and grep) mikefazz Programming 2 08-31-2004 08:38 PM
sed & grep script? dolvmin Linux - Software 20 09-22-2003 07:30 AM

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

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