[geeks] Suggestions on a postcard...

Will Mc Donald wmcdonald at ntlworld.com
Thu May 2 13:06:21 CDT 2002


Potential newbie stuff alert... I need some help here guys. I have a bundle of
files with names including loads of characters reserved for the shell. For
example...

[wmcdonald at fw tb_archive]$ ls -tr | head
List Manager response.eml
Address verification request.eml
List Manager response (1).eml
[E&OE] Special exercises to stay fit at your desk.eml
RE_ [E&OE] 66.eml
Re_ [E&OE] 66 (2).eml
[E&OE] AD&D Stats = Real Life.eml
Re_ [E&OE] AD&D Stats = Real Life.eml
Re_ [E&OE] AD&D Stats = Real Life (3).eml
Re_ [E&OE] AD&D Stats = Real Life (4).eml

Now I'm trying to cat these files into one big mbox file. The eventual goal is
to get all this mail archived and searchable (I'm thinking MHonArc or
something) but first I'd really like to get all the old mails out of OE format
and into something useful (I know, use a proper client but all the old stuff
needs converting).

My first thought was to just list all the filenames out to another file then
use sed to single quote each line (preventing shell expansion?) then read the
lines back in from that.

[wmcdonald at fw tb_archive]$ ls -tr | head > tmpfile
[wmcdonald at fw tb_archive]$ sed "s/^/'/g" tmpfile > tmpfile.1
[wmcdonald at fw tb_archive]$ sed "s/$/'/g" tmpfile.1 > tmpfile.2
[wmcdonald at fw tb_archive]$ cat tmpfile.2
'List Manager response.eml'
'Address verification request.eml'
'List Manager response (1).eml'
'[E&OE] Special exercises to stay fit at your desk.eml'
'RE_ [E&OE] 66.eml'
'Re_ [E&OE] 66 (2).eml'
'[E&OE] AD&D Stats = Real Life.eml'
'Re_ [E&OE] AD&D Stats = Real Life.eml'
'Re_ [E&OE] AD&D Stats = Real Life (3).eml'
'Re_ [E&OE] AD&D Stats = Real Life (4).eml'
[wmcdonald at fw tb_archive]$
[wmcdonald at fw tb_archive]$ for file in `cat tmpfile.2 `
> do
> cat $file > tb.mbox
> done
cat: 'List: No such file or directory
cat: Manager: No such file or directory
cat: response.eml': No such file or directory
cat: 'Address: No such file or directory
cat: verification: No such file or directory
cat: request.eml': No such file or directory

etc...

Any ideas?  Is there an easier way to do this? Please bear in mind
IANAPgrammer. :)

Will.



More information about the geeks mailing list