Created
March 28, 2010 16:17
-
-
Save voyeg3r/346837 to your computer and use it in GitHub Desktop.
sed - transformando url em link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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