Mailing List
Home
Linux - General Red Hat Linux discussion list
Enterprise Linux 3 - Discussion of Red Hat Enterprise Linux 3 (Taroon)
Red Hat Linux 9 - Discussion of Red Hat Linux 9 (Shrike)
Installation - Getting started with Red Hat Linux
Red Hat Linux 7.3 - Discussion of Red Hat Linux 7.3 (Valhalla)
Red Hat Linux 8.0 - Discussion of Red Hat Linux 8.0 (Psyche)
Red Hat Linux 7.2 - Discussion of Red Hat Linux 7.2 (Enigma)
Red Hat Linux 7.1 - Discussion of Red Hat Linux 7.1 (Seawolf)
Apache Web Server
Oracle database, Microsoft SQL server ...
Subjects
application/x mplayer2 plugin
RPM error: db4 error(16) from dbenv >remove: Device or resource
   busy
Command stream end of file while reading
X Windows problem (xauth)
Upgrading openoffice 1 1 rpm
FTP: connection refused
FTP: connection refused
mount: /dev/cdrom: is not a valid block device
Dell Precision 650, RedHat 9, no sound
how to trace the cause resulting in the crash of bind server
Virus on the list
UNINSTALL RPM MYSQL
usb pen drives: mounting as a user
broadcom network interface
make mrproper
sendmail configuration on redhat
Couldn 't open PID file /var/run/named/named pid Permission denied
Promise 378 controller
kernel 2 6 and /dev/sound/mixer not found
Problem using up2date
mrtg step by step howto/configuration for a newbie?
Compiling and Installing Kernel 2 6
Can 't locate module ppp0, can 't locate module ppp compress 21
HOW I CAN MAKE BOOTABLE FLOPPY DISKET
Lotus Notes under Wine
/etc/security/limits conf question
Intel E/1000 driver
Command stream end of file while reading
rpm database corrupt
qla2300 modules
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Sed, awk? [solved]

Sed, awk? [solved]

2003-12-18       - By Jake McHenry

 Back
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

> -- --Original Message-- --
> From: shrike-list-admin@(protected)
> [mailto:shrike-list-admin@(protected)] On Behalf Of Ben Yau
> Sent: Thursday, December 18, 2003 1:44 PM
> To: shrike-list@(protected)
> 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@(protected)
> 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