> -----Original Message----- > From: shrike-list-admin@xxxxxxxxxx > [mailto:shrike-list-admin@xxxxxxxxxx] On Behalf Of John Haxby > Sent: Thursday, December 18, 2003 8:36 AM > To: shrike-list@xxxxxxxxxx > Subject: Re: Sed, awk? > > > Jake McHenry wrote: > > >Thanks! Would there be a way to get them all on one line instead of > >many, seperated by a space for input to another command? > Being they are > >all on their own lines, it's kind of messy for input to another > >command. > > > > > echo $(oneliner | grep 'whatever' | cut -f1 -d:) > or > echo $(oneliner | awk -F: '/whatever/' {print $1}') > or > echo $(oneliner | sed -n '/whatever/s/:.*//p') > or > echo $(oneliner | perl -ne 'if (/whatever) {split(/:/); > print @_[0] > . "\n"}') > or > echo $(for i in $(oneliner | grep '/whatever/'); do echo > "${i%:*}"; > done) > > (This last one has problems when "oneliner" produces lines that match > the RE that contain spaces, but that's fixable.) > > > Replace "echo" with the command of your choice. > > How many different ways would you like? This is Unix :-) I > got bored > thinking up different ways. > > > Actually, I've just noticed you said: > > oneliner | grep 'whatever' * > > In this case grep looks for whatever in all the files in the current > directory. What's the purpose of "oneliner"? Or is the > "*" an oversight. > > jch > > > > > > > > -- > Shrike-list mailing list > Shrike-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/shrike> -list > Wow.. Thanks Actually.. It's Add_spam | grep 'whatever' * | cut -f1 -d: Can I do that? I need the result of grep 'whatever' * | cut -f1 -d: on one line and it's the input into add_spam, a small shell script I did that takes all the file names seperated by spaces. Thanks, Jake -- Shrike-list mailing list Shrike-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/shrike-list