In article <[EMAIL PROTECTED]>, Jim Showalter <[EMAIL PROTECTED]> wrote: >Specifically, I want is to find all lines in a.txt that match any of
So far, this sounds like a grep. >the following three groups of lines in b.txt: > >1-0 >[Event "ICC"] [snip] >1-0 > >[Event "ICC"] > >should not match because there is an intervening blank line. Oh, a multi-line pattern. This does what you asked for: perl -nle 'print "$prev\n$_" if $prev =~ [EMAIL PROTECTED](1-0|0-1|1/2-1/2)$@ && $_ eq q/[Event "ICC"]/; $prev=$_' file >Also, if anyone knows how I can accomplish this easily with vim, that >would even be better. But I have never been able to figure out how >to include end-of-lines or blank-lines in vim searches. I can search for newlines just fine with vim, using \n. >Or maybe I have to use some other tools? If I can guess your intent (rather than just giving you exactly what you asked for), these are probably what you really want: # Find all lines that exactly match [Event "ICC"] and print them, together # with 1 preceding line. grep -B 1 -Fx '[Event "ICC"]' file # Same thing, then get rid of the [Event "ICC"] lines and the separators # leaving only the lines that preceded the [Event "ICC"] lines grep -B 1 -Fx '[Event "ICC"]' file | grep -Fxv -e '[Event "ICC"]' -e '--' # Building on the previous example, group and count the occurrences of each # result grep -B 1 -Fx '[Event "ICC"]' file | grep -Fxv -e '[Event "ICC"]' -e '--' | sort | uniq -c -- The attacker\x92s overall goal would very probably be to convince other users to run an unsafe program, by using the digital signature to convince them that it is actually bona fide Microsoft software and therefore safe to run. -- security bulletin MS01-017 ushers in a new definition of "safe" _______________________________________________ help-gnu-utils mailing list help-gnu-utils@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-utils