Reputation: 17553
Can anybody tell me what is wrong with the following bash code
for f in $FILES
do
cut -d, f1-7 < $f > $f.tmp
done
When I run in the loop
echo "cut -d, f1-7 < $f > $f.tmp"
I get the right command output and when I run that command by itself, it works perfectly. But when I run it in the bash loop, it doesn't work, I get the following error:
cut: you must specify a list of bytes, characters, or fields
Try `cut --help' for more information.
Any ideas?
Upvotes: 0
Views: 1086
Reputation: 4384
I think you miss a minus sign in your cut command:
cut -d, -f1-7 < $f > $f.tmp
Upvotes: 3