RE: Sed, awk? [solved]

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

 



> -----Original Message-----
> From: shrike-list-admin@xxxxxxxxxx 
> [mailto:shrike-list-admin@xxxxxxxxxx] On Behalf Of Ben Yau
> Sent: Thursday, December 18, 2003 1:44 PM
> To: shrike-list@xxxxxxxxxx
> Subject: RE: Sed, awk?
> 
> 
> 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
> 
> 
> Cheers-
> Ben Y
> 
> 
> 
> == 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?
> 
> Thanks,
> Jake
> 
> 
> -- 
> Shrike-list mailing list
> Shrike-list@xxxxxxxxxx 
> https://www.redhat.com/mailman/listinfo/shrike> -list
> 


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.

Thanks for all the help



Thanks,

Jake McHenry
Nittany Travel MIS Coordinator
http://www.nittanytravel.com





-- 
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