I am new to shell scripting and what I need is to read from a file that contains a 2d array. Assume there is a file named test.dat which contains values as:
- Paris London Lisbon
- Manchester Nurnberg Istanbul
- Stockholm Kopenhag Berlin
What is the easiest way to select an element from this table in linux bash scripts? For example, the user inputs -r 2 -c 2 test.dat that implies to selecting the element at row[2] and column[2] (Nurnberg).
I have seen the read command and googled but most of the examples were about 1d array.
This one looks familiar but could not understand it exactly.