linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: csoler@euskalnet.net
To: Jens Knoell <jens@surefoot.com>
Cc: Linux Admin <linux-admin@vger.kernel.org>
Subject: Re: sed problem
Date: Fri, 05 Mar 2004 08:42:46 +0100	[thread overview]
Message-ID: <35a8138f03.38f0335a81@euskalnet.net> (raw)

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

             reply	other threads:[~2004-03-05  7:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-05  7:42 csoler [this message]
2004-03-05  8:55 ` sed problem 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35a8138f03.38f0335a81@euskalnet.net \
    --to=csoler@euskalnet.net \
    --cc=jens@surefoot.com \
    --cc=linux-admin@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).