[Cialug] Text file munging
chris
chris at ia.gov
Thu Jun 18 13:46:34 CDT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dave Weis 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?
>
If I understand what you need this may work, if not tell me w where I went wrong and I'll fix it.
perl -p -i -e 's/<(key|string)>.+<\/(key|string)>//' *
That'll *modify the original file* in place and leave a blank line where any
<key>.+</key>
<string>.+</string>
are found.
crr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAko6i4oACgkQPmaZdRmQd+ZGVQCfcrHYpaRdgUpqzpW30vCKfAxn
X/MAnj886FREV8YytWMoSbanVIlj7d76
=NEbX
-----END PGP SIGNATURE-----
More information about the Cialug
mailing list