How can I add various strings that appear in a text file?
Posted on 2014-09-09
I would like a script to look at a text file, line by line, and where it finds the following strings, it should add the amount which immediately follows.
A sample of what part of the lines might look like are the following.
Whenever the script sees a line which starts with LO1, it should then take the number that follows the two ** and then multiply it by the next number which appears in the line. In the above case, the first line would be 540*45.05.. and so forth for every line.
The resulting data should be the total of all the multiplied lines in a new text file, which perhaps shows the first line of data which was found in the file, and then maybe on the second line, it should show the total.
For instance, the contents of the new text could be..
contents of the first line in the file
Total Dollar Value: $29751.00