RE: Sed, awk? [solved]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
Shrike-list mailing list
Shrike-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/shrike-list

[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux