1. The problem statement, all variables and given/known data:
Find the line that contains the word 'the' 3 times.
2. Relevant commands, code, scripts, algorithms:
can only use tee, tr, grep, head, tail, sort, uniq, cut, paste, join and cat
3. The attempts at a solution (include all code and scripts):
I've got a general idea of how to do it but i don't know how to put it all into a command. The marked /**/ line above is the line i should be printing out as it contains 3 "the".
This is not the first question in my lab but its the 6th. The previous question don't ask to analyse lines, rather count words with 10 letters, turn upper case to lower case. list unique words only once.
So my main problem is knowing how to check each line for the word 'the' occurring 3 times.
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
FIT3042 Monash, Australia, Victoria, Computer Science, John Hurst.
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Last edited by bakunin; 04-07-2010 at 12:50 PM..
Reason: provided some code-tags for free
How do you write a script that counts the number of times a word appears in a file and output it?
Original:
ID1 SMARCB1;Adil;Jon
ID2 Jon;Annie;Mei
ID3 Adil;Spaghetti;NBA
ID4 Raptors;wethenorth;SMARCB1
ID5 SMARCB1;wethenorth
Objective:
SMARCB1: 3
Adil: 2
Jon: 2... (5 Replies)
Hi!!
I am trying to write a program which allows me to count how many times I used the same word in a text:
{$0 = tolower ($0)
gsub (/_]/, "", $0)
for (i = 1; i <= NF; i++)
freq++
}
END {
for (word in freq)
printf "%s\t%d\n", word, freq
It seems work but... (3 Replies)
I have a file: file.txt, which contains the following data in it.
This is a file, my name is Karl, what is this process, karl is karl junior, file is a test file, file's name is file.txt
My name is not Karl, my name is Karl Joey
What is your name?
Do you know your name and... (3 Replies)
Hi All,
Hope you guys had a wonderful weekend
I have a scenario where in which I have to read a file line by line
and check for few words before redirecting to a file
I have searched the forum but,either those answers dint work (perhaps because of my wrong under standing of how IFS... (6 Replies)
Hi friends
i need a help on Perl Script
In My Home directory, i have some other directories and inside those directories i have some subdirectories and all the directories contains files.
Now i want to count a word in all files and i want the output like below
wordcount in which file(name... (5 Replies)
Hello,
I try to insert a post because I've got a trouble to perform a unix job. But I didn't found which steps (procedure) I should follow. Could you help me?
I got a log by my Application box, like following:
gbosmam037:test >view Log_Server.csv
... (2 Replies)
In a file I have to count a particular word. like i need apache how many times.
I tried this
$ tr "\011" "\012\012"<foo1 | tr -cd "" |sort\uniq -c
but I got result like this
32 apache
18 dns
12 doctor
Please sugest me (4 Replies)
Hi All,
I have a quary regarding grep command in linux.
I have a file which contains
56677
56677
+56677
+56677
56677
56677
56677
I want to extract total count of "56677"
When I hit the following command
#cat filename | grep -w -c '56677'
the result comes 7. Its counting... (3 Replies)