Hi there! Thanks for taking the time to read this. Anyways, here is my problem.
I have inside a text file both characters and integers and I would like to add the integers together. I used the 'cut' command to extract the integers and assign the array to a variable called 'array'. This is how I did it:
Code:
array=$(cut -c52-53 file1)
echo $array
And the output of this is:
19 20 21 18 25 30 12 18 25 10
My question is how would I go about adding the integers together? I heard you would use a for loop but I just can't wrap my head around it. Any help is greatly appreciated.
FYI: I am programming in BASH