[thelist] bash, read from several file

Kinjal kinjal at tendercity.com
Sat Apr 17 05:59:02 CDT 2004


A cheap low tech solution could be something like this

	cat name.txt email.txt > t.txt

String together all the other files you want.

Then use t.txt like you are using name.txt

Then delete t.txt

Hth
K.

>#!/bin/sh
>while read name;
> do psql -d nobody nobody -c "INSERT INTO contact(name) 
>VALUES('$name');" ; done< ./name.txt
>
>But this only reads one file.
>
>How can I read from two files (or more) at one time. Say name.txt and 
>email.txt and then do.
>
>"INSERT INTO contact(name,email) VALUES('$name','$email');"
>
>I am looking for a bash solution, but a php one could help me.
>
>// Magnus



More information about the thelist mailing list