Hello everyone I'm working on a list of urls where I only need to grep all file names that end with .asp or .aspx and there should not be any duplicates as well so I came across this solution to remove everything before the last / and after .asp
I tried this regex which removes everything before the last /
([^\/]+$)
e.g.
abc/abc/abc/xyz.asp >> xyz.asp
But if there is a / after .asp it starts selecting after that /
abc/abc/abc/xyz.asp?ijk=lmn/opq >> opq which i do not want
I want to grep only strings that has .asp and .aspx and remove every single character before the last / and after it.
I simple words I want to grep the filename.asp or filename.aspx only
Sample Input
https://www.redacted.com/abc/xyz.aspx?something=something
Sample output:
xyz.aspx
Sample input:
https://www.redacted.com/abc/xyz/file.aspx?z=x&LOC=http%3A%2F%2Fwww.redacted.com%2Fasp%2Fanotherfile-asp%2F_%2FCRID--7%2Fthirdfile.asp%3Fui%3Dhash
sample output:
file.aspx, anotherfile-asp, thirdfile.asp