1

I have two files, one with url's other with id's

for line in $(cat urls_file); do
for id in $(cat ids_file); do
touch topic_$id
curl $line|grep "data\-topic=">topic_$id
done
done

BUT it does for every $line all the $id 's and i want to do for each line each id.

1 Answer 1

2

BUT it does for every $line all the $id 's and i want to do for each line each id.

In that case you should use paste to have 2 column data from 2 input files:

while read -r line id; do
   curl "$line" | grep 'data-topic=' > "topic_$id"
done < <(paste urls_file ids_file)

There is no need to use touch as curl will create the file anyway.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.