0

I wrote a grep command in order to grep URLs which starts with http/https from file. I used a regex which is: (https?:\/\/)([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?

For the string http://google.com/hello/from/here, I wanted to get the full URL. However, when I ran the script the output was http://google.com/. How can I force the grep command to find everthing between each slashes (until the end of the line or the first space)?

Thanks in advance.

ItayNG
  • 11
  • `([a-z\.]{2,6})`? ".museum" isn't the longest TLD anymore. – C14L May 22 '16 at 08:12
  • [edit] your question to have a [mcve] including concise, testable sample input (e.g. your target URLs in context surrounded by other strings) and expected output, otherwise we're guessing blindly at your needs. – Ed Morton May 22 '16 at 13:04

0 Answers0