- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to investigate a file line fore line
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 02:55 AM
07-10-2001 02:55 AM
I have a file with emailadresses and descriptions both fixed length. how can i investigate the file line for line to mail de description to the emailadres at the beginning of the line.
sample file:
email@adres1 this is description for adres 1
email@adres2 this is description for adres 2
etc
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 03:00 AM
07-10-2001 03:00 AM
Re: how to investigate a file line fore line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 03:18 AM
07-10-2001 03:18 AM
Re: how to investigate a file line fore line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 03:27 AM
07-10-2001 03:27 AM
Re: how to investigate a file line fore line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 03:32 AM
07-10-2001 03:32 AM
Solution# while read ADDR DESC
> do
> mailx -s "$DESC" $ADDR < /dev/null
> done < myfile
This will mail each ADDR a message whose subject is the DESC (one or more words!). The body of the message will be empty (/dev/null) although you could specify any file appropriate.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 03:33 AM
07-10-2001 03:33 AM
Re: how to investigate a file line fore line
i don't have the time to write a whole script right now. But i would use the following parts.
sed -n -e "$n P" filename
This will get line numer $n from the file filename. Put this in a variable or something. Then i would use cut to get the email adress and the rest seperated.
echo $line | cut -f1 -d' '
this will get you the first field of the line, where a blank is the field seperator. This should be your emailadress.
echo $line | cut -f2- -d' '
the rest of the line (filed 2 to the end). Now you can use this information to feed your desired mailapplication like elm, mail, pine ....
Put the whole thing in a loop to read the file line by line.
Hope this helps
Regards Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 03:34 AM
07-10-2001 03:34 AM
Re: how to investigate a file line fore line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 03:35 AM
07-10-2001 03:35 AM
Re: how to investigate a file line fore line
with the command upon you'll get the addresses.
Federico
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 03:41 AM
07-10-2001 03:41 AM
Re: how to investigate a file line fore line
try :
cat
This will generate system calls like :
echo "DESCRIPTION TEXT" | mail "EMAIL ADDRESS"
for each non empty lines
HTH
Herv?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 03:41 AM
07-10-2001 03:41 AM
Re: how to investigate a file line fore line
while read line
do
dest=`echo $ line | cut -f1 -d' '`
subj=`echo$ line | cut -f2- -d' ' `
mailx -s $subj $dest
done < yourfile
should do the job
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 03:47 AM
07-10-2001 03:47 AM
Re: how to investigate a file line fore line
as so often JRF postet first with the best solution.
James, i already learned a lot. Hope you stay with us for a long time. There is still plenty i have to learn.
BTW: when do you plan to reach the 20000 points ;-)
Regards Stefan