Skip to content

Instantly share code, notes, and snippets.

@clarkritchie
Created December 14, 2023 16:51
Show Gist options
  • Save clarkritchie/7c3cdc91043e7bc399b5ffc592318088 to your computer and use it in GitHub Desktop.
Save clarkritchie/7c3cdc91043e7bc399b5ffc592318088 to your computer and use it in GitHub Desktop.
#! /bin/bash
#
# quick and dirty -- for each row in CSV 1, see if that field exists in CSV 2
#
skip_headers=1
while IFS="," read -r c1 c2 c2 c4 c5 c6 c7 # 'email' is field c2
do
if ((skip_headers))
then
echo "skipping header row"
((skip_headers--))
else
echo "Checking $c2"
result=`egrep -i $c2 test2.csv`
if [ ! -z "$result" ]; then
echo "*** $c2 is in both files ***"
fi
fi
done < test1.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment