Finding unique lines

March 27, 2009 at 12:14:21
Specs: linux
I have a log file (apache) which has 404 errors . For example

/docs/foo.html 404 not found
/docs/foo.html 404 not found
/docs/foo.html 404 not found
/docs/foo.html 404 not found
/docs/cool.html 404 not found
/docs/new.html 404 not found

I want to find the html files which got 404 and show avoid redundant lines . My output should look as follows and should only contain one instance of foo.html.

/docs/foo.html 404 not found
/docs/cool.html 404 not found
/docs/new.html 404 not found


See More: Finding unique lines

Report •


#1
March 27, 2009 at 13:49:07
I'd use a staging file. Set the first file you want in it. Then compare each to the list one by one counting. If exists then go to next. If not add to list and so forth.

"Best Practices", Event viewer, host file, perfmon, antivirus, anti-spyware, Live CD's, backups, are in my top 10


Report •
Related Solutions


Ask Question