Conecting bash script with a txt file
Posted
by
cathy
on Ask Ubuntu
See other posts from Ask Ubuntu
or by cathy
Published on 2012-12-02T03:46:03Z
Indexed on
2012/12/02
5:22 UTC
Read the original article
Hit count: 293
command-line
I have a txt file with 100+ lines called page1.txt; odd lines are urls and even lines are url names. I have a bash file already created that checks urls for completion. Except right now, the process is really manual because I have to modify the bash every time I need to check a url.
So I need to connect the bash to the txt using the variable url. $url should get all the odd lines from page1.txt and check if the link is complete or not.
Also, how would I write a variable called name that derives from the url the 7 digits?
bash file manually:
url=http://www.-------------/-/8200233/1/
name=8200233
lynx -dump $url > $name.txt
I would prefer if the bash file could add "Complete/In-Complete " at the beginning of every even line in the page1.txt file but a new text file could be also created to keep track of the Completes/In-completes.
© Ask Ubuntu or respective owner