- Mar 7, 2018
- 7
- 0
- 1
I'm working on analysing data in txt format.
Data are in about 22000 files, in one main directory under many sub and sub sub-directories.
Each file has a different number of data records.
Each data record starts with the word "Type" and consists of a number of segments separated by "%" (percent character).
In order to run data analysis, I need to change the format of every data file so that:
1. first find and replace % with regex \r\n (a newline or carriage return), so that the segments will be in successive order, and
2. then find and replace the word Type with a new line above it, i.e. with \r\nType, so that each record is separated with one empty line from the record above.
I usually do this manually for a handful number of files, but when it comes to thousands of them I become in need for an expert hand to help. So can I get some precious assistance with this request, please?
Many thanks in advance.
J.
Data are in about 22000 files, in one main directory under many sub and sub sub-directories.
Each file has a different number of data records.
Each data record starts with the word "Type" and consists of a number of segments separated by "%" (percent character).
In order to run data analysis, I need to change the format of every data file so that:
1. first find and replace % with regex \r\n (a newline or carriage return), so that the segments will be in successive order, and
2. then find and replace the word Type with a new line above it, i.e. with \r\nType, so that each record is separated with one empty line from the record above.
I usually do this manually for a handful number of files, but when it comes to thousands of them I become in need for an expert hand to help. So can I get some precious assistance with this request, please?
Many thanks in advance.
J.