I have a command lline script that works perfectly.
cat <some_filename> | awk '$9 == 200' | awk '$10 == 10623720' | awk -F\" '{print $6}' | sort | uniq -c | sort -r
I want to put this in a shell script so that we do this for multiple files(all read from a file list) and write each output to different files or folders. The shell script I am trying is as follows.
#!/bin/bash
FILENAME=$1
OUTDIR1=outdir1
OUTDIR2=outdir2
OUTDIR3=outdir3
count=0
cat $FILENAME | while read LINE
do
let count++
echo "$count $LINE" >> res.txt
# Full and download of data
cmd="cat $LINE | awk '\$9 == 200' | awk '\$10 == 10623720' | awk -F"\" '{print \$6}' | sort | uniq -c | sort -r >> $OUTDIR1/$LINE"
eval $cmd
done
I am not sure what exactly I am doing wrong. This is the error I get.
trends.sh: line 16: unexpected EOF while looking for matching `"'
trends.sh: line 19: syntax error: unexpected end of file
Let me know what I am doing wrong.