Thursday, 28 March 2019

linux - Looping through files and collecting data

Ok, I have a problem that I think you guys can help with.


I have 24 folders. Labeled Angle1, Angle2, ... , Angle24


Each folder has a file name output.txt


In each file named output.txt, I want to take certain information.


There are 10 columns of data with numbers, but the numbers are variable length. I want the 9th column of numbers, but this does not mean that this is just the 9th column by characters. It could be 46 columns in or something. Anyways, each column is separated by a blank space so perhaps that would be of use.


I want to loop through Angle1, Angle2 etc. and get the 9th column of data from each and put the total of 24 columns of data into a new file in parent directory called total.txt.


This may not be possible, but just curious - is it possible?


Note that I am using Windows PowerShell but could use Ubuntu if that is easier. If any answer might not work in both environments, please indicate which environment it is for.

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...