On Tue, 14 Jan 2003, Colin Watson wrote:
> > cat testfile | xargs
>
> You win today's "useless use of cat" award. :) ('xargs < testfile')
YAaay
I'll put this one up on the mantle with the others!
Mike
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject o
On Tue, Jan 14, 2003 at 03:47:34PM -0500, Mike Dresser wrote:
> On 14 Jan 2003, Jody Grafals wrote:
> > Dose anyone know how to replace a line break with a space using sed or
> > awk?
>
> cat testfile | xargs
You win today's "useless use of cat" award. :) ('xargs < testfile')
Cheers,
--
Colin
On 14 Jan 2003, Jody Grafals wrote:
> Dose anyone know how to replace a line break with a space using sed or
> awk?
cat testfile | xargs
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
On Die, 14 Jan 2003 at 13:42 (-0500), Jody Grafals wrote:
>
> Dose anyone know how to replace a line break with a space using sed or
> awk?
>
> for example
>
> cat
> dog
> goat
> duck
>
> would become
>
> cat dog goat duck
You don't need to use sed or awk:
jan@k500:~/tmp> x=`cat animal
Using awk:
cat file | awk '{if(NR==1){printf "%s", $0;}else{printf " %s", $0;}}'
Cheers,
Bruno.
On Tue, 2003-01-14 at 13:42, Jody Grafals wrote:
> Dose anyone know how to replace a line break with a space using sed or
> awk?
>
> for example
>
> cat
> dog
> goat
> duck
>
> would become
>
On Tue, Jan 14, 2003 at 01:42:43PM -0500, Jody Grafals wrote:
>
> Dose anyone know how to replace a line break with a space using sed or
> awk?
I usually do that with tr:
cat file | tr '\012' ' '
Frank
>
> for example
>
> cat
> dog
> goat
> duck
>
> would become
>
> cat dog goat duck
Jody Grafals wrote:
> Dose anyone know how to replace a line break with a space using sed or
> awk?
>
> for example
>
> cat
> dog
> goat
> duck
>
> would become
>
> cat dog goat duck
This should do, and it's simpler than either sed or awk:
tr '\n' ' '
Craig
msg24097/pgp0.pg
Jody Grafals sez:
} Dose anyone know how to replace a line break with a space using sed or
} awk?
[...]
Wrong tool. Use tr.
tr '\012' ' '
} Thanks in advanced
} Jody
--Greg
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
8 matches
Mail list logo