I have figured out how to grep the file like this:
echo `grep $(date +'%Y-%m-%d') Cos-01.csv | cut -d',' -f1`
The above line does echo the correct information from the lines in which my search criteria is found.
Now I am trying to get that information (Yes, just one column of every line) into an array.
I would like each line to have a place in the array automatically.
EXAMPLE:
MyArray[0]=First Line
MyArray[1]=Second line etc.
I have been trying everything that I could think of and I can't get my array populated.
Is there a way to do the above? grep line by line into an array without a loop?
I wish to thank everyone in advance for their assistance.[/HTML]
---------- Post updated at 12:07 PM ---------- Previous update was at 11:42 AM ----------
I have tried doing this:
MyArray=(`grep $(date +'%Y-%m-%d') Cos-01.csv | cut -d',' -f1`)
echo {$MyArray[1]}
It seems that it is just writing each line into the variable MyArray and the last line is the one that is left. I know that I am missing something really simple but I can't seem to figure it out.