in reply to Script to reduce tokens to minimal unique characters
Here's a guess at what you want:
#!/usr/bin/perl # http://perlmonks.org/?node_id=1130246 use strict; use warnings; my @tokens = qw/report_time report_day reset read/; while(<DATA>) { /^(\w+)/ or next; my $part = $1; print "$part\n" if 1 == grep /^$part/, @tokens; } __DATA__ report_t 14:09:33 PDT report_d Fri Jun 12 2015 report (should not show up) res Resetting the time report_time 00:00:00 rea foo.bar Info: reading file foo.bar
|
|---|