Get "Awk" to print columns using variable?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#16 Post by seaside »

big_bass wrote: this reads one long line only into ${arr[0]}
sometimes arr=$(<somefile) this is used to avoid using cat
but it has its limits and is not an exact replacement command for cat

Code: Select all

arr=$(</etc/rc.d/PUPSTATE)


echo ${arr[0]}
echo ${arr[1]}
echo ${arr[2]}
echo ${arr[3]}

big_bass,

Some extra protection and this works-

Code: Select all

 arr=(`echo "$(< /etc/rc.d/PUPSTATE)"`) 
Too many ramifications to think about... :)

Regards,
s

Post Reply