I am a bit new to Unix and am trying to use egrep to give me some results.
I have data in a file "data" that has lines such as this:
0 2 - - [01/Aug/2003:00:01:45 -0700] http://asd.com/bar/blah1
1 3 - - [01/Aug/2003:00:01:45 -0700] http://fgh.com/blah1.html
5 1 - - [01/Aug/2003:00:01:45 -0700] http://blah3.com/b/
4 8 - - [02/Aug/2003:00:01:45 -0700] http://hjk.com/blah3
8 3 - - [02/Aug/2003:00:01:45 -0700] http://lzx.blah3/
9 6 - - [03/Aug/2003:00:01:45 -0700] http://cvb.com/blah4
2 7 - - [04/Sep/2003:00:01:45 -0700] http://bnm.com/blah4
1 9 - - [04/Sep/2003:00:01:45 -0700] http://qwe.com/blah4
i need help making a statement(s) that can count how many occurences a specified term appears in the URL (e.g. "blah1") on a specific date. BlahN can appear anywhere in the URL. (Also the first two columns can be any numbers.. not just a single digit.. but i don't think this should affect anything)
For example, if choosing blah1 for the the term and 01/Aug/2003 as the date would return : 2.
Choosing blah 3 for the term and 02/Aug/2003 would return : 2
Choosing blah 3 for the term and 01/Aug/2003 would return : 1
Choosing blah4 for the term and 04/Sep/2003 would return : 2
and so forth.
I am incorporating this in a perl script.. i have gotten the input for the date and term stored already.. i just need help getting a grep statement for this.. or whatever else i need (e.g. "cut") .. is this possible?