I am new at shell scripting and I am trying to read data from a txt file which is in the following format.
A: 1, 2, 3, 4
B: 1,2; 3, 4
Here is my code:
awk -F':/,/;/ ' '{ echo $2 $3 $4 $5 $5 }' -f 'testread.txt'
I just need the numbers from the text file.
Thanks.
The easiest way is probably just to make your field separator “anything that isn’t numeric“.
The
$1=$1bit is just to force awk to rewrite$0using the default output field separator.Update:
More explicit output: