10/31/23, 11:53 AM shell script - Replit
shell script Invite Deploy
[Link] f1 f2 f3 Console Shell
[Link]
1 # [Link]:22b01a12g0 Name:[Link]
2 # Experiment No:5A
3 # write a shell script that accepts a list of file namesas its
arguments,counts and reports the occurence of each word that is
present in the first argument file on other argument files.
4 #!/bin/bash
5 if [ $# -eq 0 ]
6 then
7 echo "NO arguments"
8 else
9 tr " " "\n" < $1 >temp
10 shift
11 for i in $*
12 do
13 tr " " "\n" < $i >temp1
14 y=`wc -l <temp`
15 j=1
16 while [ $j -le $y ]
17 do
18 x=`head -n $j temp | tail -1`
19 c=`grep -c "$x" temp1`
20 echo $x $c
21 j=`expr $j + 1`
22 done
23 done
24 fi
[Link] 1/1