0

I have a large .csv file and I need a batch process to create a new file with only certain lines that have unique identifier in the first column.

CSV looks like this. Need to create a new .csv with only the 554,134,and 6852 records.

554,Apple,car,tommy 554,cherry,bike,tom 554,banna,skateboard,tomisina

844,Apple,car,tommy 844,cherry,bike,tom 844,banna,skateboard,tomisina

134,Apple,car,tommy 134,cherry,bike,tom 134,banna,skateboard,tomisina

6852,Apple,car,tommy 6852,cherry,bike,tom 6852,banna,skateboard,tomisina

78,Apple,car,tommy 78,cherry,bike,tom 78,banna,skateboard,tomisina

1 Answer 1

1

I can't figure out why this was never answered before?! The answer is quite simple:

findstr /b /c:"554," /c:"134," /c:"6852," "input.csv" >"output.csv"

If you have a long list of IDs to search, prepare a file with one search string per line like so:

554,
134,
6852,

Then change the command to use the search strings in the file:

findstr /b /g:"searchStrings.txt" "input.csv" >"output.csv"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.