Article 6HN12 AWK not working FOR LOOP

AWK not working FOR LOOP

by
clcbluemont
from LinuxQuestions.org on (#6HN12)
This works:
int=$(file "$flac"|awk -F ": FLAC" '{print $1}')
echo "$int"

This works:
find . -type f -name "*.flac" -exec sh -c '
for flac do
int=$(file "$flac"|grep 44.1)
echo "$int"
done
' exec-sh {} +

I cannot understand why this does not work:
find . -type f -name "*.flac" -exec sh -c '
for flac do
int=$(file "$flac"|awk -F ": FLAC" '{print $1}')
echo "$int"
done
' exec-sh {} +

The error are:
: 3: Syntax error: end of file unexpected (expecting ")")
})
echo "$int"
done
: 3: Syntax error: end of file unexpected (expecting ")")
})
echo "$int"
done
: 3: Syntax error: end of file unexpected (expecting ")")
})
echo "$int"
done
: 3: Syntax error: end of file unexpected (expecting ")")

I am hand typing the commands in.

Any help is greatly appreciated!
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments