Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Find all lines from one file in another file (I'm using csv)
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 3.
#!/bin/bash
# Search through the contents of this file
search="{full file path}"
# Find contents from this file
pattern="{full file path}"
grep -f <(tr ',' '\n' < "${patterns}") "${search}"
# To find contents that is NOT in the search file add -v to the grep command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment