So I have text file that I need to reformat so I can import it into a spreadsheet. I was originally going to do this in Java, since I had a vague familiarity with it, but there are few good classes in Java that are useful for text processing, and the solution in Java would be more complex than it needs to be.
This is my input file: store-orders.txt
Items purchased by TexasStore:
Orders: 7 Unique: 4 OutofStock: 0
StockID DepartmentID Instances
34.34 12 10
34.3 12 6
2.75 6 55
Items purchased by FloridaStore:
Orders: 6 Unique: 6 OutofStock: 1
StockID DepartmentID Instances
34.27 12 78
33.3 6 27
5.75 7 33
I need my output to be:
TexasStore 34.34 12
TexasStore 34.3 12
TexasStore 2.75 6
FloridaStore 34.27 12
FloridaStore 33.3 6
FloridaStore 5.75 7
This way I can import it into excel and sort the other values.
What programming/scripting language do you think would be most suited for this kind of text formating?
If I am going to learn a programming language to solve 1 problem, I would like to select one with native support for this kind of thing.
Here is a pseudo example of what I want to do:
read store-orders.txt
while (next.line() != null) {
if ((grep Store $line) == true)
$store = (awk '{print $4}');
fi
if ($line == ^number)
print.line ($store $1 $2);
fi
}
You would think something that is 6 lines of pseudo code would not require pages of Java but it isn't the kind of problem Java is intended to solve.
So about how difficult would a problem like be with VB.NET?