Issue
Let's say I have a file named plaintext.txt which have 2 lines and a content of
you can be social online by logging in to http://www.facebook.com and http://plus.google.com
alternatively, you can also create an account in http://www.twitter.com
I know that I can display the whole contents of the file by issuing a cat statement in the command-line like
cat plaintext.txt
I wanted to collect all of the URL links from the plaintext such that I can display
http://www.facebook.com
http://plus.google.com
http://www.twitter.com
I presume the command line statement for this one would be something like
cat plaintext.txt | grep something
but I don't exactly know how.
How is it possible to use grep for collecting URL links?
Solution
sed 's/\s/\n/g' plaintext.txt | grep http:
where plaintext.txt
is the file containing your two lines.
Answered By - unxnut Answer Checked By - Dawn Plyler (WPSolving Volunteer)