RE: Very Simply KSH Question

Took you long enough.....

-----Original Message-----
From: Jared Still [mailto:jkstill@xxxxxxxxx]
Sent: Tuesday, April 05, 2005 4:36 PM
To: Ethan.Post@xxxxxx
Cc: Kevin Lange; carmen.rusu@xxxxxxxxxxxxxxx;
mgogala@xxxxxxxxxxxxxxxxxxxx; oracle-l@xxxxxxxxxxxxx
Subject: Re: Very Simply KSH Question


I can't take it any more.

Convert to Perl.

Now.

-------------

#!/usr/bin/perl

while(<DATA>) {
        my ($junk,$x,$y,$z) = split(/\|/);
        print qq{
X: $x
Y: $y
Z: $z
};
}

__DATA__
KEY|FOO|WRECK|CAR



On Apr 5, 2005 9:03 PM, Post, Ethan <Ethan.Post@xxxxxx> wrote:
> list is in file
> 
> KEY|FOO|WRECK|CAR
> 
> need to assign field 2 to X, 3 to Y...
> 
> I hate...
> 
> X=3D$(cat file | grep "^FOO" | awk -F"|" '{ print $2}')
> Y=3D$(cat file | grep "^FOO" | awk -F"|" '{ print $3}')
> ...
> 
> in many scripts I...
> 
> grep "^FOO" file | awk -F"|" '{ print $2" "$3" "$$ }' | read X Y Z

-- 
Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist
--
http://www.freelists.org/webpage/oracle-l

Other related posts: