Skip to content

Instantly share code, notes, and snippets.

@voyeg3r
Created March 28, 2010 16:17
Show Gist options
  • Save voyeg3r/346837 to your computer and use it in GitHub Desktop.
Save voyeg3r/346837 to your computer and use it in GitHub Desktop.
sed - transformando url em link
# source: http://stackoverflow.com/questions/2489731/convert-urls-into-html-links-using-sed
# Convert URLs into HTML links using sed?
sed -i.bakup 's|http.[^ \t]*|<a href="&">&</a>|' htmlfile
# a primeira dica: a troca do delimitador padrão pela barra vertical
# segunda dica, após o http ele pega o resto da linha exceto espaços e tabulações [^ \t]
# terceira dica: uma vez que o padrão vai para a memória do sed pode ser referenciada com o &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment