We help IT Professionals succeed at work.
Get Started

Count All Search Terms

blnukem
blnukem asked
on
163 Views
Last Modified: 2010-03-05
Hi All

I have several folders with text files in this structure:
 
log/9.5.2007/search.txt
log/9.6.2007/search.txt
log/9.7.2007/search.txt
log/9.8.2007/search.txt
log/9.9.2007/search.txt

The file search.txt contains search words used on the site for that day in this structure:

Date|IP|Page|SearchWords
Date|IP|Page|SearchWords
Date|IP|Page|SearchWords
Date|IP|Page|SearchWords


What I need to do is open all of the search.txt files and count how may times a keyword was search for and list the keywords in numerical order from highest to lowest count.

So if during the day Widgets was searched for 3 times and Toywidgets was search for 1 time the script would output:

Widgets 3
Toywidgets 1
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE