Hello to all,
Dear Powershell Experts I need your help.
A Text file with Pipe-Delimiters of 13 fields, the 2nd field represents CSV file name and the search criteria is in the 5th field. Top line is header, records start from line2, the line length is 227 characters in single line.
I want to search the particular csv file [which is mentioned in 2nd field] for 5th field serial number of text file in very large CSV database.
Once that serial is located in the CSV file, copy the 1st field and replace the 7th field of the text file and 2 & 3 fields of CSV file to the end of line in the text file, after 227 character.
In this if a particular csv file or search serial is not found continue next search just copy the original line/record from the text file to New Text file.
Text File Structure.
-Field 1—|-Field 2—|-Field 3–|-Field 4——–|Field 5-|-Field 6—-|F7|-Field 8—-|Field9|..|Field 13|
004196202|010010481|01110001|0091000440191|610209|4000000089|22|0000000001|ends at 227 char.
003221311|044003610|20222014|0000000500000|051548|0201001000|05|2000100000|ends at 227 char.
———|csv file name| ————————|Search|———–|replace|
CSV File Database Structure.
F1, F2, F3,
72,2321,8272,819710,819711,819712,819713,819714,819715,819716,819717,819718,819719,81920
010010481.csv
14,4595,26172,610201,610202,610203,610204,610205,610206,610207,610208,610209,610210,…,
044003610.csv
12,1122,311,051541,051542,051543,051544,051545,051546,051547,051548,051549,051550
Result To New Text file:
004196202|010010481|01110001|0091000440191|610209|4000000089|14|0000000001|after 227 char.|4595,26172
003221311|044003610|20222014|0000000500000|051548|0201001000|12|2000100000|after 227 char.|1122,311
The CSV data is very large, I need some very beautiful codes which can search very faster, & i feel this can be achived with powershell the real power.
Many Many Thanks in advance.