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!
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!