linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: sed problem
@ 2004-03-05  7:42 csoler
  2004-03-05  8:55 ` urgrue
  2004-03-09  8:46 ` Stephen Samuel
  0 siblings, 2 replies; 6+ messages in thread
From: csoler @ 2004-03-05  7:42 UTC (permalink / raw)
  To: Jens Knoell; +Cc: Linux Admin

Hi Jens,

----- Mensaje Original -----
De: "Jens Knoell" <jens@surefoot.com>
Fecha: Jueves, Marzo 4, 2004 6:08 pm
Asunto: sed problem

> Oke... sed-hell again.
> 
> Case: I have a file that has lines separated by pipe chars. I need 
> to split
> it back into a line-by-line file. So I tried this (the ^M has been 
> enteredby pushing Ctrl+V, Enter):
> echo "This|should|be|on|separate|lines" | sed -e "s/|/^M/g"
> 
> The result:
> linesate
> 
> I'm sure I'm missing something, but hours of googling didn't get me
> anywhere. Any ideas?

I think awk fits better for this task, IMHO of course :-)

csoler@gudu$ echo "This|should|be|on|separate|lines" | awk -F"|" '{for 
(i=1; i<= NF; i++) print $i}'
This
should
be
on
separate
lines

I hope this helps you...

Cheers,
César

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread
* sed problem
@ 2004-03-04 17:08 Jens Knoell
  2004-03-04 17:17 ` Glynn Clements
  2004-03-04 17:25 ` Matt Hemingway
  0 siblings, 2 replies; 6+ messages in thread
From: Jens Knoell @ 2004-03-04 17:08 UTC (permalink / raw)
  To: Linux Admin

Oke... sed-hell again.

Case: I have a file that has lines separated by pipe chars. I need to split
it back into a line-by-line file. So I tried this (the ^M has been entered
by pushing Ctrl+V, Enter):
echo "This|should|be|on|separate|lines" | sed -e "s/|/^M/g"

The result:
linesate

I'm sure I'm missing something, but hours of googling didn't get me
anywhere. Any ideas?

Thanks
Jens


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-03-09  8:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-05  7:42 sed problem csoler
2004-03-05  8:55 ` urgrue
2004-03-09  8:46 ` Stephen Samuel
  -- strict thread matches above, loose matches on Subject: below --
2004-03-04 17:08 Jens Knoell
2004-03-04 17:17 ` Glynn Clements
2004-03-04 17:25 ` Matt Hemingway

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).