> -----Original Message----- > From: Steven W. Orr [mailto:steveo@xxxxxxxxxxx] > Sent: Thursday, December 18, 2003 3:53 PM > To: Jake McHenry > Cc: shrike-list@xxxxxxxxxx > Subject: RE: Sed, awk? [solved] > > > On Thursday, Dec 18th 2003 at 15:03 -0500, quoth Jake McHenry: > > =>> I too am having a bit of a problem underestanding what you > =>> are asking . Do you want all the output to be on one line > =>> instead of one entry per line? It really shouldn't matter > =>> what kind of white space you pipe in to your next program. > =>> Whitespace is pretty much whitespace (newline vs space). =>> > =>> Anyway, try something like this. > =>> > =>> 1) grep 'alsdjf' * | awk -F: '{print $1}' | xargs echo -n =>> > =>> if uniqueness is an issue, then use htis: > =>> > =>> 2) grep 'alsdfj' * | awk -F: '{print $1}' | uniq | xargs > echo -n =>> > =>> In 1) if "alsdjf" appears morethan one in the file, then the > =>> filename will come up twice in your grep statement. if > =>> that's not what you want, then use > =>> 2) > =>> > =>> explanation: > =>> ------------ > =>> awk -F: ----> (use colon as the field separator) > =>> '{print $1}' ----> (print the first column ) (similar to your > =>> php explode) > =>> | xargs ----> (take all the output ) > =>> echo -n ----> (echo without newline ) > =>> > =>> let me know if that's what you're looking for > =>> == Original Message Follows == > =>> grep 'alsdjf' * | cut -f 1 -d : > =>> > =>> Returns all the filenames:what I'm searching for, growing > =>> rapidly, right now the line count is around 200. What I want > =>> to do with this output is input it into a script I made, > =>> which contains sa-learn --args.. $*, where $* is the output > =>> from grep and cut. > =>> > =>> I need the output from grep and cut to be all on the same > =>> line, not the 200+ as it currently is. > =>> > =>> So, is there a way to have the output from grep and cut to be > =>> all on one big line seperated by spaces? > => > =>Number 2 worked good, but I'm having problems getting it > all to work =>in one line. => =>I tried spam.spam which just > takes args like spam.spam file1 file2 =>file3, etc. => =>I've > tried your number 2 piped into spam.spam, and spam.spam piped > =>into your number 2, neither worked. It works if I run your > number 2 =>then copy and paste after spam.spam. => =>This > will work for now, I'd like it so that I could just run one > =>file... But right now don't have much time. > > I've been listening to this thread and for the life of me, > I'm just not > sure I understand what it is that you're looking for, but just on the > offchance that I *do* understand: > > grep -l alsdjf * > > -- > Time flies like the wind. Fruit flies like a banana. Stranger > things have .0. happened but none stranger than this. Does > your driver's license say Organ ..0 Donor?Black holes are > where God divided by zero. Listen to me! We are all- 000 > individuals! What if this weren't a hypothetical question? > steveo at syslang.net > Ok. Here is what I have. I have some bash files with: arg=$* sa-learn --<list of args> $arg One file is spam.spam, one is spam.ham, etc... They just have different args in the sa-learn line... Anyways.. I then need input of any files in the directory containing an email address, all on the same line for the input to spam.spam or spam.ham..etc. So.. This works for the first part: grep -R 'email' * | awk -F: '{print $1}' | uniq | xargs echo -n This also works: grep 'email' * | cut -f 1 -d : | tr \\012 \\40 I then need that input to go into the spam.spam or spam.ham files as if I typed it all like: spam.spam file1 file2 file3 file4 I can't figure out how to do this part, as I tried: grep 'nittany' * | cut -f 1 -d : | tr \\012 \\40 | spam.spam And spam.spam | grep 'nittany' * | cut -f 1 -d : | tr \\012 \\40 Neither worked. So, for the time being, I said I will just run the first comamnd, copy and past after the spam.spam or spam.ham filename. Does this clear things up? I understand what I want to do... Sorry if I'm not explaining correctly. Do you need anymore info? Thanks for the help, Jake -- Shrike-list mailing list Shrike-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/shrike-list