Skip to content

Instantly share code, notes, and snippets.

@cmandesign
Last active January 15, 2020 09:04
Show Gist options
  • Select an option

  • Save cmandesign/bb970ee77ac6f973253cc594b5e9420e to your computer and use it in GitHub Desktop.

Select an option

Save cmandesign/bb970ee77ac6f973253cc594b5e9420e to your computer and use it in GitHub Desktop.
Find common records between two large files with grep

Here is the command to search records in the first file inside of the second file :

grep -f firstFile.csv SecondFile.csv > FoundRecords.csv

But if there are more thant 100k records on each file, you must split them into 100K line to prevent the command get killed or become not responding. Here is the command to split the file :

split -l 100000 sourceFile.csv sourceFile_part_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment