How can I extract from a certain number of files all the URIs like magnet: file:? I'd like to have one URI per line as the output.I'd like to use bash to achieve this, but any suggestion is welcome.I'm using debian 7.The input is a bunch of html files with random names. The URIs will all be in a href HTML tags like: <a href='magnet:?xt=something1:something1:somerandomcharacters'>link text</a>. There isn't a scheme of how the URIs are stored in each file, there may be n URIs per file and they may be wherever in the files.Expected output should be a list with values separated by new line character like:magnet:?xt.......magnet:?xt.......magnet:?xt.......
How to extract URIs from files
shell script;text processing
I suppose the URI ends with a space: grep -o 'magnet://[^ ]*' filenameUpdate: grep -o magnet:?xt[^']* filenameUpdate: cat * | grep -o magnet:?xt[^']* or grep -oh magnet:?xt[^']* *