Hi guys,
What is the regex to check for only valid URL from a file using grep?
Hello Meeran,
As a starting point could you please try following and let me know if this helps you. Let's say we have following Input_file.
cat Input_file
http://google.com/test
http://raddi.com/raddi
Following is the code for same.
awk '{match($0,/.*[:]\/\/.*\/[[:alnum:]]+/);print substr($0,RSTART,RLENGTH);}' Input_file
Output will be as follows.
http://google.com/test
http://raddi.com/raddi
Thanks,
R. Singh