LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I need some help with SED and/or GREP... (https://www.linuxquestions.org/questions/linux-newbie-8/i-need-some-help-with-sed-and-or-grep-525111/)

TheEngineer 02-02-2007 07:24 PM

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

Tinkster 02-02-2007 08:17 PM

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


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