Alan Curry wrote: > In article <[EMAIL PROTECTED]>, > > I can search for newlines just fine with vim, using \n. >
Well I'll be... that works - thanks! > > 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 > Well, you didn't quite guess my intent. I just want to find cases where there is no intervening blank line and insert one. If we find this: 1-0 [Event "ICC"] We change it to this: 1-0 [Event "ICC"] Thanks much, jim -- _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ _/ Everything should be made as simple as possible, but not simpler. _/ -- Albert Einstein _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ _______________________________________________ help-gnu-utils mailing list help-gnu-utils@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-utils