[Solved] sed, awk, perl or lex: find strings by prefix+regex, ignoring rest of input [closed]
If you won’t have more than one of the pattern on a single line, I’d probably use sed: sed -n -e ‘s%.*https://\([-.0-9A-Za-z]\{1,\}\.[A-Za-z]\{2,\}\).*%\1%p’ Given the data file: Nothing here Before https://example.com after https://example.com and after Before you get to https://www.example.com And double your https://example.com for fun and happiness https://www.example.com in triplicate https://a.bb and nothing here The … Read more