Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read each line of a file

Status
Not open for further replies.

cougartrace

Technical User
Sep 9, 2003
29
US
Hi all,

If I have a file that looks like this:

dallas
new york
chicago
los angeles

In a unix script how I can grab one line at a time in that file and email it to someone?
 
Something like this ?
while read buf
do echo "$buf" | mail -s 'your subject' someone@somewhere
done < /path/to/yourfile

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks a bunch.

This is much more simple than the way I was trying.

CougarTrace
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top