[wellylug] Is there a good way to....

Enkidu enkidu at cliffp.com
Thu Jan 29 21:08:30 NZDT 2004


Um, it's basically to strip some dud records from a log file. It
depends a lot on the dud records, so that's not a simple question to
answer.

Cheers,

Cliff

On Thu, 29 Jan 2004 18:21:23 +1300, you wrote:

>Oops. It should probably be:
>
>sed -e '/RE/!s/(.*)/\1/g' filename
>
>Note the changed position of the exlamation mark.  I still can't
>guarantee it will work though!
>
>If you can let us know what string you need to match, I'm sure someone
>can give you the RE part explicitly.
>
>TB
>
>Enkidu wrote:
>
>> Is there a good way to drop lines from a file or do I have to do 
>> something like
>> (pseudo-code) ....
>> 
>> Open Output
>> 	Open Input
>> 	Read While Input
>> 		If Record is a Match
>> 			Then Write Output
>> 			Else Nothing
>> 	End Read
>> 	Close Input
>> Close Output
>> 
>> Cheers,
>
>Well, I only have access to a Windows machine right now, so I haven't
>tested this, but you could try:
>
>sed -e '/RE!/s/(.*)/\1/g' filename
>
>Where:
>
>* RE is a regular expression to match (as in your 'Record is a Match'
>pseudo-code) 
>* The exclamation mark _should_ negate the RE, so that only lines not
>matching are picked up.  This isn't totally clear from the
>documentation, but I hope it will work.
>* (.*) is the line from the file (you might need backslashes before each
>bracket)
>* \1 means to replace the line with the the (.*) text (i.e. take the
>whole line and just print it out)
>
>Best of luck.

-- 

I think that Don Brash is a Labour mole.
That would explain everything.




More information about the wellylug mailing list