I'm trying to write a little bash script on ubuntu 12.04 and have little experience. Odd little problem converting a text file of numbers into arrays. I need all of the first numbers, second, etc into it's own array because I'll be running computations on numbers based on column more than the line it came from. All lines are 5 integers separated by spaces with a return at the end of each line. Is a multidimensional array possible in bash? Thank you!
Ubuntu – Writing a bash script to read a text file of numbers into arrays, by column, on Ubuntu
12.04bashscripts
Best Answer
Here is a script, it will store numbers from text file into two arrays
x
andy
as you wished,Do not forget to give the script execution permission.
Usage
where I am considering you will save the above script as
script.sh
and your textfile containing numbers isnumfile.txt
. And both are in same directory.