hellb0y77 hellb0y77 - 2 months ago 7
Bash Question

Bash: get multiple value from text file in the same line

i have a text file with 2 string per line, i need make a

curl
command whith these vales

text file:

www.example.com 38494740
www.example.org 49347398
www.example.net 94798340


I need create a command
curl
for lines, eg.

curl www.example.com/38494740
curl www.example.org/49347398
curl www.example.net/94798340


I have considerate
while
but i have 2 string per line....

UPDATE:

I need use these values as variable, the command can also be this way
curl www.exmple.com/foo/38494740

PS. PS.
Answer
awk -v OFS="/" '{$1=$1}1' curl
www.example.com/38494740
www.example.org/49347398
www.example.net/94798340

Explanation :
OFS defines how your output fields would be separated. Here its set to "/".
{$1=$1} : is to make awk to reconstruct the records so new OFS will come into effect.
1: is awk's default action to print the line.

As per comments :

while read domain sub
do

curl "$domain"/"$sub"


done < curl
Comments