All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Samuel <samuel@bcgreen.com>
To: csoler@euskalnet.net
Cc: Jens Knoell <jens@surefoot.com>,
	Linux Admin <linux-admin@vger.kernel.org>
Subject: Re: sed problem
Date: Tue, 09 Mar 2004 00:46:03 -0800	[thread overview]
Message-ID: <404D844B.8090805@bcgreen.com> (raw)
In-Reply-To: <35a8138f03.38f0335a81@euskalnet.net>

sed 's/|/\n/g'

(( I like using single quotes, because you're less likely to get
    characters like '\' and '$'  eaten by the shell ))



csoler@euskalnet.net wrote:
> 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


-- 
Stephen Samuel +1(604)876-0426                samuel@bcgreen.com
		   http://www.bcgreen.com/~samuel/
    Powerful committed communication. Transformation touching
      the jewel within each person and bringing it to light.
-
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

  parent reply	other threads:[~2004-03-09  8:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-05  7:42 sed problem csoler
2004-03-05  8:55 ` urgrue
2004-03-09  8:46 ` Stephen Samuel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-05-28 17:28 Kathy_Emory
2004-05-28 21:51 ` Paul Jackson
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=404D844B.8090805@bcgreen.com \
    --to=samuel@bcgreen.com \
    --cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.