HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Programming/Scripts (http://www.howtoforge.com/forums/forumdisplay.php?f=7)
-   -   Batch Rename emails in vmail (http://www.howtoforge.com/forums/showthread.php?t=57271)

mmidgett 12th May 2012 17:17

Batch Rename emails in vmail
 
I have moved mail from my old server to the new one and the server name is stored into the file name. just copying the mail over it is displayed in IMAP but the new servers mails and other old servers mail are not sorted properly. I thought it might be the file name.

I want to change

-rw------- 1 vmail vmail 9455 May 6 06:31 1336300280.M851460P7400V000000000000FC00I002A0136_ 0.webster.trickhosting.biz,S=9455:2,S

to

-rw------- 1 vmail vmail 9455 May 6 06:31 1336300280.M851460P7400V000000000000FC00I002A0136_ 0.web1.trickhosting.biz,S=9455:2,S

and I have hundreds of files to change so it would be nice if I could just point a script to a directory and let it change them recursively.

Will someone help me with this?

A4P 19th May 2012 01:58

Batch Vmail Renaming
 
Hi,

It's really simple using "sed".

There was a time long ago when I had a similar issue and it double dawned on me that some of the best tools in NIX are the oldest AND best which are "sed" & "awk".

I could write a bash script for you but as I did many years ago before there were great tools to post like this one, just IRC that I found learning how to use "sed" and "awk" on my own has kept the knowledge intact for a few decades.

Hope this helps? :)

And forgive the bad pun following:

"Just listen to what the man sed".
Paul McCartney & Wings 1976

:eek:


All times are GMT +2. The time now is 21:12.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.