This is my first time using Bash Scripting and I have the following tasks at han
ID: 3748270 • Letter: T
Question
This is my first time using Bash Scripting and I have the following tasks at hand I am not sure I am doing correctly. Your assistance and guidance would be greatly appreciated. Thank you so much!
1. Use wget to retrieve the index page from www.cisco.com 2. Perform command: tr-d ‘ri index1.html 3. Perform command: grep SOMETHING li a href- and save to textl.txt 4. Pipe the cut command to the original grep command and save as text2.txt. 5. Pipe another grep command to the end of our command to extract lines we want: (HINT: the is the escape character). Save as text3.txt 6. Clean it up some more. Save as text4.txt 7. Clean it up some more. Save as text5.txt 8. Clean it up some more. Save as text 6.txt 9. NOW WE HAVE A CLEAN LIST OF DOMAIN NAMES, SO THE NEXT STEP IS CONVERTING THEM TO IP ADDRESSES.Explanation / Answer
Part 1
For Windows
First, define the path for the environment variable.
For example, path C:Windowssystem32;
wget --html-extension -r www.cisco.com
This will get the index page and convert and save it in your PC as html extension
Part 2
tr command is used for translating or deleting characters.
tr -d 'r' index.html
This command will delete all the occurrences of r from file index.html and
tr -d 'r' index.html index1.html
This command will delete all the occurrences of r from both the files index.html and index1.html
but tr -d ' ' <index.html> index1.html does not seem to have any meaning.
Part 3
grep -i 'r' text.html > text1.txt
This command will get you all the words containing the letter r or R in the file text.html
but grepping from '<li><a href-"abc.html" ' is different as there is only limited text to grep from this.
Still if you want you can use
grep -i '<li><a href-"abc.html">Click Here</a></li>' a.html > text1.txt
This command will grep <li><a href-"abc.html">Click Here</a></li> from file a.html and save the output to text1.txt
Part 4
grep -i '<li><a href-"abc.html">Click Here</a></li>' a.html | cut -c '<','>' > text2.txt
This command will grep <li><a href-"abc.html">Click Here</a></li> from a.html and then cut '<' and '>' character from it and save it to the text2.txt file.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.