Skip to content

Instantly share code, notes, and snippets.

@florian25686
Last active June 30, 2021 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save florian25686/db7a46f9e4e6074b182221519440bfdf to your computer and use it in GitHub Desktop.
Save florian25686/db7a46f9e4e6074b182221519440bfdf to your computer and use it in GitHub Desktop.
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