Thursday 21 May 2015

Write a shell script that accept a list of filenames as its argument, count and report occurrence of each word that is present in the first argument file on other argument files..VTU MCA UNIX LAB7A

for x in `cat $1`
do
    for file in $*
    do
        if [ "$file" != "$1" ]
        then
        echo "$x"
        c=`grep -iow $x $file | wc -w`
        echo "$c"       
        fi
    done
done

No comments:

Post a Comment