[Nottingham] saved by the shell ?

Martin Kirk martin at applab.co.uk
Tue May 20 19:09:02 BST 2008


Hi All,

thanks to everyone who tried, but the prize goes to Peter this time !

Michaels solution fell foul of the 'Argument list too long' problem.
Andrew's perl thing i'm not sure about - it might have worked if i'd let it 
run.
Roger's i didn't try as Peter solution had already done it.

thanks again guys,
Martin.


On Tuesday 20 May 2008 17:44, Peter Chang wrote:
> Martin,
>
> > i have shell access to the server so was hoping i could use some
> > command-line trickery to remove all messages with a given subject line.
> >
> > after a bit of googling i figure i need something along the lines of :-
> > 	grep "My Subject Line" ./* | xargs rm
> > but i'm getting an error "bin/grep: Argument list too long"
> >
> > can anyone put me on the right track ?
>
> The recipe you gave doesn't do what you want!
>
> The error is just that there's too many files in your mail directory. So
> you need to use find(1) to generate a list of filenames then go through
> each to see if it contains the '^Subject: My subject' line and then delete
> accordingly.
>
> $ find $mymaildir -type f -exec grep -q '^Subject: My subject' {} \; \
> -print0 | xargs -0 rm -f
>
> Best to check that is actually does what you need by replacing 'rm -f'
> with 'echo'.
>
> hth,
>   Peter
>
>
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses, which could damage your computer
> system: you are advised to perform your own checks. Email communications
> with the University of Nottingham may be monitored as permitted by UK
> legislation.
>
>
> _______________________________________________
> Nottingham mailing list
> Nottingham at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/nottingham



More information about the Nottingham mailing list