[Cialug] Text file munging

Chris Freeman cwfreeman at gmail.com
Thu Jun 18 13:47:55 CDT 2009


What's the format of 'remote-id'?
Are the <key> and <string> lines always at the same tab-stop in the files?
Do you need to remove all matching lines, or just the first?

With some assumptions, here goes:

for msg in `ls *.mail`
do
grep -v "\t<key>remote-id</key>" ${msg} | grep -v
"\t<string>.*<string>" > out/${msg}
done

Chris

On Thu, Jun 18, 2009 at 12:45 PM, Dave Weis<djweis at internetsolver.com> wrote:
>
> I have a bunch of individual email messages from mail.app that have been
> disassociated from their mailbox. I have tried copying them into the
> messages folder but they don't go because of two lines in the plist at the
> end. I need to remove
>         <key>remote-id</key>
>         <string>4294</string>
> from 20,000 files. The number varies and the location at the end of the
> file can move a few lines at a time. I've tried my regex magic on it but
> don't have enough to get it working. Any help?
>
> --
> Dave Weis
> djweis at internetsolver.com
> http://www.internetsolver.com/
>
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>


More information about the Cialug mailing list