<<< Date Index >>>     <<< Thread Index >>>

Re: Display Filters



Troy Piggins wrote:
> * Gary Johnson wrote:

Thanks for sharing your scripts.  Very interesting.  I will probably
being using at least one of them!

> > Here's the more conservative of my "[-- .* --]" filters:
> > 
> > sed -e '
> >     /^\[-- Autoview using .* --]$/d
> >         /^^[][0-9;]*^G\[-- Autoview using .* --]$/d
> >     /^\[-- Attachment .* --]$/d
> >         /^^[][0-9;]*^G\[-- Attachment .* --]$/d
> >     /^\[-- Type: .* --]$/d
> >         /^^[][0-9;]*^G\[-- Type: .* --]$/d
> > '
> > 
> > Note that the ^[ and ^G pairs should be replaced by a real ESC and a 
> > real BEL before using the command.
> 
> Gary - I'm giving this one a go, but can't get the BEL character
> figured out.  I got the ^[ by hitting ctrl-v then ESC, but how do
> your get the BEL?

The bell character is control-g so you should be able to get it the
same way as your escape character.  In your case using ctrl-v ctrl-g
and you should have a literal control-g in the input.

As a matter of style I frequently just use '.' to match any character
there and ignore the fact that it is possible to match something
else.  In that way I don't have to worry about cutting and pasting the
code and problems that might arise.

sed '
        /^\[-- Autoview using .* --]$/d
        /^.][0-9;]*.\[-- Autoview using .* --]$/d
        /^\[-- Attachment .* --]$/d
        /^.][0-9;]*.\[-- Attachment .* --]$/d
        /^\[-- Type: .* --]$/d
        /^.][0-9;]*.\[-- Type: .* --]$/d
'

Bob