I have got a csv file (records .csv) which has 400,000 records without any header and each row in it looks like below format:
"1","222","",3333","666",777",""
"2","234","","345","234","456",""
Here first column that is "1" and "2" in above example is unique number (lets call it URN ) defining each row
Task: i got a list of 1000 urn numbers in a txt file (urn.txt) and I have been asked to edit above csv file(records .csv) such that to keep only these thousand records and delete all other rows..
Urn.txt files have one column specifying unique number (urn) and looks like below:
1
13
16
Manually it is taking time, is it possible to do it from poweshell script?
I know the logic that i need my script to first read csv file then break the row into object using comma delimiter, than i need to read txt file and i need to use loop to read each row from txt file and then find that number in csv file first column and if it is there than just copy whole row into new csv file.
I am not a programmer and i have no skill set of powershell so i am finding it difficult to write this into script. Can anyone help me
"13",? This should be possible using a combination of this answer explaining how to remove lines from a text file and this answer explaining how to search for multiple values from another input file