Extraire les liens hypertextes dans un fichier html
Résolu
chrisee
Messages postés
212
Statut
Membre
-
UnGars -
UnGars -
Bonsoir,
J'aimerais extraire tous les liens dans une page html et les afficher en les alignant en order et proprement,mais cette page contient certains lien dans du codes js
J'ai essayé avec: cat monfichier.html |grep "href=" mais ça m'affiche toujours tout,j'suis pas pro en linux en tout cas,et merci pour l'aide
J'aimerais extraire tous les liens dans une page html et les afficher en les alignant en order et proprement,mais cette page contient certains lien dans du codes js
J'ai essayé avec: cat monfichier.html |grep "href=" mais ça m'affiche toujours tout,j'suis pas pro en linux en tout cas,et merci pour l'aide
2 réponses
-
Salut,
Essaie avecgrep -o 'http://[^"]*' tonfichier.html
-
-
salut
pas mal, mais ne marche pas convenablement avec ça :
d to edit your /etc/fstab file and add
"user_xattr" to the mount options. For more information take a look at: <a class="extern" target="_blank" href="https://wiki.gentoo.org/wiki/Netflix/Pipelight#Adding_support">https://wiki.gentoo.org/wiki/Netflix/Pipelight#Adding_support</a> (just skip the Kernel configuration part as it is now default in almost all distributions)</p>
car j'obtiens
https://wiki.gentoo.org/wiki/Netflix/Pipelight#Adding_support
https://wiki.gentoo.org/wiki/Netflix/Pipelight#Adding_support</a> (just skip the Kernel configuration part as it is now default in almost all distributions)</p> -
Salut,
Essaye avec ça :grep -o 'http://[^"<]*'
$ cat fich
d to edit your /etc/fstab file and add
"user_xattr" to the mount options. For more information take a look at: <a class="extern" target="_blank" href="http://wiki.gentoo.org/wiki/Netflix/Pipelight#Adding_support">http://wiki.gentoo.org/wiki/Netflix/Pipelight#Adding_support</a> (just skip the Kernel configuration part as it is now default in almost all distributions)</p>
$ grep -o 'http://[^"<]*' fich
http://wiki.gentoo.org/wiki/Netflix/Pipelight#Adding_support
http://wiki.gentoo.org/wiki/Netflix/Pipelight#Adding_support -
-
Salut,
Même sous Debian, sans le "-E" ça passe ;-))
Basic vs Extended Regular Expressions
In basic regular expressions the meta-characters ?, +, {, |, (, and ) lose their special meaning; instead use the backslashed versions \?, \+, \{, \|, \(, and \).
Traditional egrep did not support the { meta-character, and some egrep implementations support \{ instead, so portable scripts should avoid { in grep -E patterns and should use [{] to match a literal {.
GNU grep -E attempts to support traditional usage by assuming that { is not special if it would be the start of an invalid interval specification. For example, the command grep -E '{1' searches for the two-character string {1 instead of reporting a syntax error in the regular expression. POSIX allows this behavior as an extension, but portable scripts should avoid it.
-
-