scripts

Various scripts for UNIX-like systems
git clone https://git.tronto.net/scripts
Download | Log | Files | Refs | README

urlgrep (233B)


      1 #!/bin/sh
      2 
      3 # Find all URLs in stdin, print them newline-separated to stdout
      4 
      5 protocols='http|https|ftp|sftp|gemini|mailto'
      6 valid_chars="][a-zA-Z0-9_~/?#@!$&'()*+=.,;:-"
      7 regex="(($protocols):|www\.)[$valid_chars]+"
      8 
      9 egrep -o "$regex"