At 08:38 PM 1/31/2004, Daniela wrote:
I was wondering how I can do the following with sed (or another program):

How's Perl, Daniela?

1. Output only the text from the start of the line to the first pipe character

$out = ($line =~ /^([^\|]+)/);

2. Output only the text between the last and the previous pipe character

$out = ($line =~ /\|([^\|]+)|/);

Or, split the line at the pipe characters and assign the parts to different shell variables.

my @ary = split '|', $line;

These are untested but probably pretty close at least. Sorry, I haven't gotten to shell scripting yet so I think in terms of Perl.

Marty Landman   Face 2 Interface Inc 845-679-9387
This Month's New Quiz --- Past Superbowl Winners
Make a Website:

[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to