Re: Very Simply KSH Question
- From: Jared Still <jkstill@xxxxxxxxx>
- To: Ethan.Post@xxxxxx
- Date: Tue, 5 Apr 2005 13:35:47 -0800
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
- References:
- RE: Very Simply KSH Question
- From: Post, Ethan
Other related posts:
- » Very Simply KSH Question
- » Re: Very Simply KSH Question
- » Re: Very Simply KSH Question
- » RE: Very Simply KSH Question
- » RE: Very Simply KSH Question
- » Re: Very Simply KSH Question
- » Re: Very Simply KSH Question
- » RE: Very Simply KSH Question
- » RE: Very Simply KSH Question
- » RE: Very Simply KSH Question
- » RE: Very Simply KSH Question
- » RE: Very Simply KSH Question
- » RE: Very Simply KSH Question
- » Re: Very Simply KSH Question
- » RE: Very Simply KSH Question
- » RE: Very Simply KSH Question
- » Re: Very Simply KSH Question
- » RE: Very Simply KSH Question
- RE: Very Simply KSH Question
- From: Post, Ethan