Welcome to WebmasterWorld Guest from 35.172.217.40

Forum Moderators: bakedjake

Message Too Old, No Replies

shell script to loop through file?

     
4:43 pm on Apr 12, 2006 (gmt 0)

Full Member

10+ Year Member

joined:Nov 19, 2003
posts:291
votes: 0


Hi all,

I'm moving my listserv into a new program. I need to add all my subscribers to the list.

I have a .txt file with one email per line. I want to loop through the file and add each address.


loop
python jmlm.py -s email@address.com
end loop

How can I accomplish this?

Thanks!
Erik

7:34 pm on Apr 12, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 12, 2005
posts:371
votes: 0


Erik,

Assuming that the file the addresses is in is called email_list, then this should work for you:

cat email_list ¦ xargs python jmlm.py -s

xargs executes commands based on input. Hopefully that works for you, let me know if you have any problems. Oh, and make sure to replace the ¦ with a real pipe (WebmasterWorld changes it).

Chad

8:05 pm on Apr 12, 2006 (gmt 0)

Full Member

10+ Year Member

joined:Nov 19, 2003
posts:291
votes: 0


Thanks for the help.

A problem though, it only seems to add the first email address in the file.


temp.txt

1@test.com
2@test.com
3@test.com

The listserv script takes 1 email address at a time


python jmlm.py -s email@adress.com

So how can I loop through each of the emails in the file and run them through the python script?

Thanks!
Erik

8:27 pm on Apr 12, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Apr 12, 2005
posts:371
votes: 0


Erik,

Give this a try, see if it works any better for you:

cat email_list xargs -i python jmlm.py -s {}

Chad

8:33 pm on Apr 12, 2006 (gmt 0)

Full Member

10+ Year Member

joined:Nov 19, 2003
posts:291
votes: 0


worked like a charm! Awesome! thanks!

Erik

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members