Operating System - HP-UX
1821638 Members
2998 Online
109633 Solutions
New Discussion юеВ

Re: Help with a .CSV file and my UNIX box

 
Brent Cramer
New Member

Help with a .CSV file and my UNIX box

The Exchange Administrator creates me a .CSV file from his NT server that contains names, internal ids, and internet ids that I will use as a source file for my script on my UNIX box.
Currently he sends me an email that has the .CSV file as an attachment and of course I want to scriptize the whole process of getting the file, stripping out the informatin I need, and storing it on my UNIX server.
I can strip out the information and store it, but what I need help is how do I get it from a .CSV email attachment into a form I can work with?
I have seen many postings about taking and attaching files as attachments and sending it to Exchange but not the other way.
Any help would be appreciated.
6 REPLIES 6
Paula J Frazer-Campbell
Honored Contributor

Re: Help with a .CSV file and my UNIX box

Hi
Brent

Why not use ftp to get or receive the file?


Paula
If you can spell SysAdmin then you is one - anon
Brent Cramer
New Member

Re: Help with a .CSV file and my UNIX box

That is definitely a viable option but I was trying to have a mechanism where the Exchange Admin did not have to get involved with id's, permissions that are involved with ftp's. I just wanted to be able to strip it off the email.
I thought it should be fairly straightforward to automatically save the attachment..but perhaps I am making this harder than it has to be?
Paula J Frazer-Campbell
Honored Contributor

Re: Help with a .CSV file and my UNIX box

Hi

If the NT admin sets up ftp for you then you can cron a small script to pick up the csv file.

# Get the file
ftp -n <user
prompt
binary
cd
get *.csv
quit
End_of_Ftp
echo "Send to 172.20.20.17 done"

HTH

Paula
If you can spell SysAdmin then you is one - anon
Paula J Frazer-Campbell
Honored Contributor

Re: Help with a .CSV file and my UNIX box

Hi

If the NT admin sets up ftp for you then you can cron a small script to pick up the csv file.

# Get the file
ftp -n <user
prompt
binary
cd
get *.csv
quit
End_of_Ftp


HTH

Paula
If you can spell SysAdmin then you is one - anon
Rodney Hills
Honored Contributor

Re: Help with a .CSV file and my UNIX box

If you are looking for a process to extract an email attachment. Then take a look at "ripmime". Don't know how well it works, but the description sounds like what you want.

You can find it at the HP-UX Porting Centre
http://hpux.cs.utah.edu
and do a search for ripmime
There be dragons...
Gregory Fruth
Esteemed Contributor

Re: Help with a .CSV file and my UNIX box

You can use Perl to automatically process e-mail
using the .forward file or the sendmail aliases file.
Perl has modules for working with MIME messages.
MIME::Parser and perhaps MIME::Entity will be of use.

The following Perl code reads a MIME message from
stdin and saves the mesg body and the attachments
to the directory "somedir".

use MIME::Parser;
$p = new MIME::Parser;
$p->output_dir("somedir");
$e = $p->read(\*STDIN);

HTH