Experts Exchange connects you with the people and services you need so you can get back to work.
while IFS="," read file count
if [[ -f folderA/$file ]]
if [[ $(wc -w <folderA/$file) -eq $count ]]
echo "$file has matching word count"
echo "$file has mismatched word count."
echo "$file does not exist"
Open in new window
for i in `cat 1.txt`; do
if [ -e $i ]; then
echo "File $i exists..."
wanted=`echo $i | cut -d, -f 2`
count=`cat $i | wc -l`
if [ "$wanted" == "$count" ]; then
echo "Word count matches"
echo "Word count doesn't match"
echo "File $i doesn't exists..."
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.