Front page | perl.beginners |
Postings from May 2008
Re: sed split on pipe
Thread Previous
|
Thread Next
From:
Jay Savage
Date:
May 8, 2008 06:51
Subject:
Re: sed split on pipe
On Tue, May 6, 2008 at 7:27 AM, Jack Butchie <pauliecat@sasktel.net> wrote:
> Have been googling for some time now and every command I tried fails. I
> want to use sed from the command line or use it in a windows batch file to
> split on a pipe delimited file, windows server. The examples have \n as the
> carriage return code, but all that happens is the pipe is replaced by the
> letter n.
>
> the file has a space between each line
>
> CALL|TITLE|URL LINK|
>
> CALL|TITLE|URL|LINK
Maybe your files have windows line endings, or you haven't accounted
for the the examples assuming a unix shell, which handles quotes
differently?
Sine this is a Perl list, though, perhaps you would like to try using
Perl instead of sed? Something along the lines of the following should
work.
perl -F'|' -lane 'print join "\n", @F unless /^\s*$/'
# or
perl -lpane 's/|/\n/'
On Windows you may need to change the quotes around.
HTH
-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential
daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org
values of β will give rise to dom!
Thread Previous
|
Thread Next