in reply to Locating "Patterns" in a log file (e.g. keywords, etc)
If it's a Linux/Unix system you can use the system's tool grep:
grep PATTERN FILE_TO_SEARCH_IN > FILE_WITH_SEARCH_RESULTS
More info can be found in the manpage of grep.
a simple perl solution could look like this (using some perl magic):
#!/usr/bin/perl use strict; use warnings; my $pattern = shift @ARGV; while (<>) { print if m/$pattern/; }
Save that to a file and execute it this way:
perl script.pl PATTERN FILE_TO_SEARCH_IN > FILE_WITH_SEARCH_RESULTS
update:
formatting changes
perl example added
|
|---|