Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Scenario :
==========There is an enrolment data file containing details of a centre and the subject codes with other details which can be given as :
2002/sem2/abc1234/abc1 : 2345/E/XX
2002/sem1/abc1235/xyz1 : 4556/D/RR
2002/summer/abc1235/dec1 : 2350/E/RR
2002/sem2/abc1234/abc1 : 2345/E/RR-------------
N.B. :Chennai = XX
Bombay = RRThe data file is entered using pico editor manually. We assume the data file exists.
I want to know how could a user using the either (bash/shell) script can find the occurance of words like abc1235 occuring in a file eg. words like XX, RR and to count them and to print them.
The user is to enter the command on the command line prompt like
./occur.sh enrol.dat 2002 sem2 abc1234 abc1235
and the output must be :
Code Chennai Bombay Total
==== ======= ====== =====
abc1234 1 1 2
abc1235 0 2 2I did using grep command to cut the value, but I was able to cut only one value but how to count the occurance of multiple words in a file. Any help from the Linux gurus/Linux Community will be appreciated.
Thanks,
Regards,
Kaleem.

![]() |
Ethernet Card Not Initial...
|
intel 845 chipset sound d...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |