xmastree
February 19th, 2006, 04:34 AM
I need to filter some log files, and I want to do it by erasing every line which does not contain a certain string.
e.g. the file is like this:
10:15 Station 10 Time started
10:25 Station 15 Time Started
11:25 Station 10 Time Ended
11:55 Station 15 Time Ended
Only much, much longer (2,800 lines). I wish to generate (from this example) two files. One containing only Station 10's information and one for Station 15's. There are more stations than just those two, so I figured i could run a command on the file a few times (or from a script) to delete every line not containing "Station 10" and output the remainder to a file, which would just contain 10's data.
etc. for the rest.
Or is there an easier way?
e.g. the file is like this:
10:15 Station 10 Time started
10:25 Station 15 Time Started
11:25 Station 10 Time Ended
11:55 Station 15 Time Ended
Only much, much longer (2,800 lines). I wish to generate (from this example) two files. One containing only Station 10's information and one for Station 15's. There are more stations than just those two, so I figured i could run a command on the file a few times (or from a script) to delete every line not containing "Station 10" and output the remainder to a file, which would just contain 10's data.
etc. for the rest.
Or is there an easier way?