Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Very Simply KSH Question
actually I found a better way playing around
IFS=3D"|"
read X Y Z < file_name
The file contains a list of records in which the "|" deliminates the various fields. So your method would not be best in this case. I also need to grep a particular record, for my purposes I will just put that in a temp file and use that. This is better than multiple lines of code which all grep the same line from the file and just awk a different field.
think the OS might be linux and that is the issue =20
-----Original Message-----
From: Mladen Gogala [mailto:mgogala_at_allegientsystems.com]=20
Sent: Tuesday, April 05, 2005 2:27 PM
To: Post, Ethan
Cc: oracle-l_at_freelists.org
Subject: Re: Very Simply KSH Question
Post, Ethan wrote:
>This works on my Solaris server, when I run on my web host (not sure
>what OS) it will not set X and Y. Both are using ksh. Is this related
>to ksh versions or is this a stupid way to set multiple variables from
a
>deliminated list?
>
> echo 2 4 | read X Y
> echo $X
>2
> echo $Y
>4
>--
>http://www.freelists.org/webpage/oracle-l
> =20
>
It is a stupid way to set multiple variables from a deliminated list.
Smart way would be this:
$ let A=3D2; $ let B=3D3 $ let C=3D$A*$B $ echo $C
--=20
Mladen Gogala
Oracle DBA
Ext. 121
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Apr 05 2005 - 15:48:13 CDT