Operating System - HP-UX
1748015 Members
4960 Online
108757 Solutions
New Discussion юеВ

How to assign File in to a ksh array

 
SOLVED
Go to solution
ashanabey
Advisor

How to assign File in to a ksh array

Hi ,


how do I assign the file values in to ksh array

sample file have below.

aa bb cc dd ee ff
gg hh ii jj kk ll


Thanks!

Ashan
legend the heart and lend the hand
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor
Solution

Re: How to assign File in to a ksh array

Hi Ashan:

#!/usr/bin/sh
echo "Enter a series of space-delimited fields to populate ARY"
read LINE
set -A ARY ${LINE}
echo "${#ARY[*]} elements exist"
echo "element_0 = ${ARY[0]}"
echo "element_1 = ${ARY[1]}"
exit 0

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: How to assign File in to a ksh array

>how do I assign the file values in to ksh array

Use $(< file): set -A ARY $(< file)