Rename a HTML file based on the content of a tag
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have a lot of html files that I want to rename according to the content of
the tag h1.
Any suggestion on how to do it on bash?
Example of a file:
<!DOCTYPE html><html lang="pt-BR"><head><meta charset="utf-8"><title>Repositório - MAIS</title>
<script src="lib/tudo.js"></script>
<link rel="stylesheet" href="lib/style.css">
</head>
<body>
<div id="cabecalho"></div>
<div id="corpo">
<h1>teste</h1>
<div class="Experimento"></div>
<div class="gallery">
<img class="image-gallery" src="img/2dados.png">
</div>
<br><br><strong>MÃÂdia:</strong> experimento (uma aula dupla)
<br><br><strong>Descrição:</strong> este experimento propõe 4 jogos diferentes, todos baseados no lançamento de 2 dados comuns. Discutindo as chances de cada jogador vencer cada um dos jogos, os estudantes terão a chance de discutir vários conteúdos relacionados àprobabilidade
<br><br><strong>Conteúdo:</strong> experimento aleatório, espaço amostral, eventos equiprováveis, probabilidade
<br><br><strong>Recomendação de uso:</strong> este experimento pode ser usado como introdução ou aplicação dos conceitos iniciais de probabilidade.
<br><br><strong>Autoria:</strong> este experimento foi desenvolvido pela <a class="externo" href="http://www.mais.mat.br" target="_blank">Mais</a> e pode ser utuilziado e distribÃÂdo livremente, contanto que citada a autoria original.
<a class="download" href="http://www.mais.mat.br/recursos/images/5/5b/2dados.pdf">Baixar</a>
</div>
<div id="rodape"></div>
</body>
</html>
I want the file renamed to "teste.html"
If it is helpful, this tag is always on the 8th line of each file and alone (nothing else on the same line). Also, there is always only one occurrence of h1 in each file.
files rename html
 |Â
show 1 more comment
up vote
0
down vote
favorite
I have a lot of html files that I want to rename according to the content of
the tag h1.
Any suggestion on how to do it on bash?
Example of a file:
<!DOCTYPE html><html lang="pt-BR"><head><meta charset="utf-8"><title>Repositório - MAIS</title>
<script src="lib/tudo.js"></script>
<link rel="stylesheet" href="lib/style.css">
</head>
<body>
<div id="cabecalho"></div>
<div id="corpo">
<h1>teste</h1>
<div class="Experimento"></div>
<div class="gallery">
<img class="image-gallery" src="img/2dados.png">
</div>
<br><br><strong>MÃÂdia:</strong> experimento (uma aula dupla)
<br><br><strong>Descrição:</strong> este experimento propõe 4 jogos diferentes, todos baseados no lançamento de 2 dados comuns. Discutindo as chances de cada jogador vencer cada um dos jogos, os estudantes terão a chance de discutir vários conteúdos relacionados àprobabilidade
<br><br><strong>Conteúdo:</strong> experimento aleatório, espaço amostral, eventos equiprováveis, probabilidade
<br><br><strong>Recomendação de uso:</strong> este experimento pode ser usado como introdução ou aplicação dos conceitos iniciais de probabilidade.
<br><br><strong>Autoria:</strong> este experimento foi desenvolvido pela <a class="externo" href="http://www.mais.mat.br" target="_blank">Mais</a> e pode ser utuilziado e distribÃÂdo livremente, contanto que citada a autoria original.
<a class="download" href="http://www.mais.mat.br/recursos/images/5/5b/2dados.pdf">Baixar</a>
</div>
<div id="rodape"></div>
</body>
</html>
I want the file renamed to "teste.html"
If it is helpful, this tag is always on the 8th line of each file and alone (nothing else on the same line). Also, there is always only one occurrence of h1 in each file.
files rename html
3
I suggest to use an XML/HTML parser (xmlstarlet, xmllint ...).
â Cyrus
Feb 17 at 17:23
Please add sample input.
â Gilles Quenot
Feb 17 at 17:28
you should never rely on a line number when dealing with XML/HTML data. Post the crucial tag name and its content
â RomanPerekhrest
Feb 17 at 17:30
Are you suggesting an edit your own post? Don't worry, the system is smart and the mods can merge your accounts. (Btw, using multiple accounts is allowed here, only misusing this is not (for example, upvoting your own post on your other account)).
â peterh
Feb 17 at 19:51
@peterh I'm afraid mods can't merge accounts. Leo, please request a merge of your two accounts by following the instructions here: unix.stackexchange.com/help/merging-accounts
â terdonâ¦
Feb 18 at 12:31
 |Â
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a lot of html files that I want to rename according to the content of
the tag h1.
Any suggestion on how to do it on bash?
Example of a file:
<!DOCTYPE html><html lang="pt-BR"><head><meta charset="utf-8"><title>Repositório - MAIS</title>
<script src="lib/tudo.js"></script>
<link rel="stylesheet" href="lib/style.css">
</head>
<body>
<div id="cabecalho"></div>
<div id="corpo">
<h1>teste</h1>
<div class="Experimento"></div>
<div class="gallery">
<img class="image-gallery" src="img/2dados.png">
</div>
<br><br><strong>MÃÂdia:</strong> experimento (uma aula dupla)
<br><br><strong>Descrição:</strong> este experimento propõe 4 jogos diferentes, todos baseados no lançamento de 2 dados comuns. Discutindo as chances de cada jogador vencer cada um dos jogos, os estudantes terão a chance de discutir vários conteúdos relacionados àprobabilidade
<br><br><strong>Conteúdo:</strong> experimento aleatório, espaço amostral, eventos equiprováveis, probabilidade
<br><br><strong>Recomendação de uso:</strong> este experimento pode ser usado como introdução ou aplicação dos conceitos iniciais de probabilidade.
<br><br><strong>Autoria:</strong> este experimento foi desenvolvido pela <a class="externo" href="http://www.mais.mat.br" target="_blank">Mais</a> e pode ser utuilziado e distribÃÂdo livremente, contanto que citada a autoria original.
<a class="download" href="http://www.mais.mat.br/recursos/images/5/5b/2dados.pdf">Baixar</a>
</div>
<div id="rodape"></div>
</body>
</html>
I want the file renamed to "teste.html"
If it is helpful, this tag is always on the 8th line of each file and alone (nothing else on the same line). Also, there is always only one occurrence of h1 in each file.
files rename html
I have a lot of html files that I want to rename according to the content of
the tag h1.
Any suggestion on how to do it on bash?
Example of a file:
<!DOCTYPE html><html lang="pt-BR"><head><meta charset="utf-8"><title>Repositório - MAIS</title>
<script src="lib/tudo.js"></script>
<link rel="stylesheet" href="lib/style.css">
</head>
<body>
<div id="cabecalho"></div>
<div id="corpo">
<h1>teste</h1>
<div class="Experimento"></div>
<div class="gallery">
<img class="image-gallery" src="img/2dados.png">
</div>
<br><br><strong>MÃÂdia:</strong> experimento (uma aula dupla)
<br><br><strong>Descrição:</strong> este experimento propõe 4 jogos diferentes, todos baseados no lançamento de 2 dados comuns. Discutindo as chances de cada jogador vencer cada um dos jogos, os estudantes terão a chance de discutir vários conteúdos relacionados àprobabilidade
<br><br><strong>Conteúdo:</strong> experimento aleatório, espaço amostral, eventos equiprováveis, probabilidade
<br><br><strong>Recomendação de uso:</strong> este experimento pode ser usado como introdução ou aplicação dos conceitos iniciais de probabilidade.
<br><br><strong>Autoria:</strong> este experimento foi desenvolvido pela <a class="externo" href="http://www.mais.mat.br" target="_blank">Mais</a> e pode ser utuilziado e distribÃÂdo livremente, contanto que citada a autoria original.
<a class="download" href="http://www.mais.mat.br/recursos/images/5/5b/2dados.pdf">Baixar</a>
</div>
<div id="rodape"></div>
</body>
</html>
I want the file renamed to "teste.html"
If it is helpful, this tag is always on the 8th line of each file and alone (nothing else on the same line). Also, there is always only one occurrence of h1 in each file.
files rename html
edited Feb 18 at 1:20
Jeff Schaller
31.2k846105
31.2k846105
asked Feb 17 at 17:19
Leo
1
1
3
I suggest to use an XML/HTML parser (xmlstarlet, xmllint ...).
â Cyrus
Feb 17 at 17:23
Please add sample input.
â Gilles Quenot
Feb 17 at 17:28
you should never rely on a line number when dealing with XML/HTML data. Post the crucial tag name and its content
â RomanPerekhrest
Feb 17 at 17:30
Are you suggesting an edit your own post? Don't worry, the system is smart and the mods can merge your accounts. (Btw, using multiple accounts is allowed here, only misusing this is not (for example, upvoting your own post on your other account)).
â peterh
Feb 17 at 19:51
@peterh I'm afraid mods can't merge accounts. Leo, please request a merge of your two accounts by following the instructions here: unix.stackexchange.com/help/merging-accounts
â terdonâ¦
Feb 18 at 12:31
 |Â
show 1 more comment
3
I suggest to use an XML/HTML parser (xmlstarlet, xmllint ...).
â Cyrus
Feb 17 at 17:23
Please add sample input.
â Gilles Quenot
Feb 17 at 17:28
you should never rely on a line number when dealing with XML/HTML data. Post the crucial tag name and its content
â RomanPerekhrest
Feb 17 at 17:30
Are you suggesting an edit your own post? Don't worry, the system is smart and the mods can merge your accounts. (Btw, using multiple accounts is allowed here, only misusing this is not (for example, upvoting your own post on your other account)).
â peterh
Feb 17 at 19:51
@peterh I'm afraid mods can't merge accounts. Leo, please request a merge of your two accounts by following the instructions here: unix.stackexchange.com/help/merging-accounts
â terdonâ¦
Feb 18 at 12:31
3
3
I suggest to use an XML/HTML parser (xmlstarlet, xmllint ...).
â Cyrus
Feb 17 at 17:23
I suggest to use an XML/HTML parser (xmlstarlet, xmllint ...).
â Cyrus
Feb 17 at 17:23
Please add sample input.
â Gilles Quenot
Feb 17 at 17:28
Please add sample input.
â Gilles Quenot
Feb 17 at 17:28
you should never rely on a line number when dealing with XML/HTML data. Post the crucial tag name and its content
â RomanPerekhrest
Feb 17 at 17:30
you should never rely on a line number when dealing with XML/HTML data. Post the crucial tag name and its content
â RomanPerekhrest
Feb 17 at 17:30
Are you suggesting an edit your own post? Don't worry, the system is smart and the mods can merge your accounts. (Btw, using multiple accounts is allowed here, only misusing this is not (for example, upvoting your own post on your other account)).
â peterh
Feb 17 at 19:51
Are you suggesting an edit your own post? Don't worry, the system is smart and the mods can merge your accounts. (Btw, using multiple accounts is allowed here, only misusing this is not (for example, upvoting your own post on your other account)).
â peterh
Feb 17 at 19:51
@peterh I'm afraid mods can't merge accounts. Leo, please request a merge of your two accounts by following the instructions here: unix.stackexchange.com/help/merging-accounts
â terdonâ¦
Feb 18 at 12:31
@peterh I'm afraid mods can't merge accounts. Leo, please request a merge of your two accounts by following the instructions here: unix.stackexchange.com/help/merging-accounts
â terdonâ¦
Feb 18 at 12:31
 |Â
show 1 more comment
5 Answers
5
active
oldest
votes
up vote
3
down vote
With xmllint :
File:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<a>foo</a>
<b>bar</b>
<c>base</c>
</body>
</html>
Command:
for file in *.html; do
tag=$(xmllint --xpath '//b/text()' $file)
echo mv "$file" "$tag_$file"
done
Comment:
Put off the echo command when your tests become ok to run the command for real
1
maybeecho mv "$file" "$tag_$file"
- that way the quotes are still correct ifecho
is deleted from the line. Also, why not put in a<h1>...</h1>
example since that's what the OP wanted? finally, a pipe tohead -n 1
would be useful in case there's more than oneh1
tag.
â cas
Feb 18 at 10:39
add a comment |Â
up vote
1
down vote
The right way with find
+ xmlstarlet
tools:
find . -type f -name "*.html" -exec sh -c
'name=$(xmlstarlet sel -t -v "//tagname" $1 2>/dev/null);
[ ! -z "$name" ] && echo mv "$1" "$1%%/*/$name.html"' _ ;
name
- variable which is assigned with a value (the contents of the tagtagname
) for the new filename[ ! -z "$name" ]
- check if a new filename is not empty (i.e.<tagname>
was found and it had a value)
add a comment |Â
up vote
1
down vote
With xmlstarlet:
xmlstarlet format --html teste.html | xmlstarlet select --html --template --value-of '//html/body/div/h1'
Output:
teste
I used xmlstarlet format --html teste.html
to fix your non valid html code.
add a comment |Â
up vote
0
down vote
If tag is alone on the 8-th line, you have many way to pick it.
tag=$( awk NR==8 file )
tag=$( awk 'NR == 8 print ;' file )
where
NR
is number of record (line number)print
is implied action
or
tag=$(sed -n 8p file)
where
-n
will not echo line8p
print 8th line.
and many other.
as notted in comment, relaying on line number is risky. If file is a valid xml file, extracting tag would be easier and safest.
add a comment |Â
up vote
0
down vote
My final solution was the code below, combining two suggestions. Thank you, guys!
for file in *.html; do
tag=$(xmlstarlet format --html $file | xmlstarlet select --html --template --value-of '//html/body/div/h1')
mv "$file" "$tag.html"
done
It worked great for my files!
add a comment |Â
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
With xmllint :
File:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<a>foo</a>
<b>bar</b>
<c>base</c>
</body>
</html>
Command:
for file in *.html; do
tag=$(xmllint --xpath '//b/text()' $file)
echo mv "$file" "$tag_$file"
done
Comment:
Put off the echo command when your tests become ok to run the command for real
1
maybeecho mv "$file" "$tag_$file"
- that way the quotes are still correct ifecho
is deleted from the line. Also, why not put in a<h1>...</h1>
example since that's what the OP wanted? finally, a pipe tohead -n 1
would be useful in case there's more than oneh1
tag.
â cas
Feb 18 at 10:39
add a comment |Â
up vote
3
down vote
With xmllint :
File:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<a>foo</a>
<b>bar</b>
<c>base</c>
</body>
</html>
Command:
for file in *.html; do
tag=$(xmllint --xpath '//b/text()' $file)
echo mv "$file" "$tag_$file"
done
Comment:
Put off the echo command when your tests become ok to run the command for real
1
maybeecho mv "$file" "$tag_$file"
- that way the quotes are still correct ifecho
is deleted from the line. Also, why not put in a<h1>...</h1>
example since that's what the OP wanted? finally, a pipe tohead -n 1
would be useful in case there's more than oneh1
tag.
â cas
Feb 18 at 10:39
add a comment |Â
up vote
3
down vote
up vote
3
down vote
With xmllint :
File:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<a>foo</a>
<b>bar</b>
<c>base</c>
</body>
</html>
Command:
for file in *.html; do
tag=$(xmllint --xpath '//b/text()' $file)
echo mv "$file" "$tag_$file"
done
Comment:
Put off the echo command when your tests become ok to run the command for real
With xmllint :
File:
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<a>foo</a>
<b>bar</b>
<c>base</c>
</body>
</html>
Command:
for file in *.html; do
tag=$(xmllint --xpath '//b/text()' $file)
echo mv "$file" "$tag_$file"
done
Comment:
Put off the echo command when your tests become ok to run the command for real
edited Feb 19 at 14:17
answered Feb 17 at 17:35
Gilles Quenot
15.3k13448
15.3k13448
1
maybeecho mv "$file" "$tag_$file"
- that way the quotes are still correct ifecho
is deleted from the line. Also, why not put in a<h1>...</h1>
example since that's what the OP wanted? finally, a pipe tohead -n 1
would be useful in case there's more than oneh1
tag.
â cas
Feb 18 at 10:39
add a comment |Â
1
maybeecho mv "$file" "$tag_$file"
- that way the quotes are still correct ifecho
is deleted from the line. Also, why not put in a<h1>...</h1>
example since that's what the OP wanted? finally, a pipe tohead -n 1
would be useful in case there's more than oneh1
tag.
â cas
Feb 18 at 10:39
1
1
maybe
echo mv "$file" "$tag_$file"
- that way the quotes are still correct if echo
is deleted from the line. Also, why not put in a <h1>...</h1>
example since that's what the OP wanted? finally, a pipe to head -n 1
would be useful in case there's more than one h1
tag.â cas
Feb 18 at 10:39
maybe
echo mv "$file" "$tag_$file"
- that way the quotes are still correct if echo
is deleted from the line. Also, why not put in a <h1>...</h1>
example since that's what the OP wanted? finally, a pipe to head -n 1
would be useful in case there's more than one h1
tag.â cas
Feb 18 at 10:39
add a comment |Â
up vote
1
down vote
The right way with find
+ xmlstarlet
tools:
find . -type f -name "*.html" -exec sh -c
'name=$(xmlstarlet sel -t -v "//tagname" $1 2>/dev/null);
[ ! -z "$name" ] && echo mv "$1" "$1%%/*/$name.html"' _ ;
name
- variable which is assigned with a value (the contents of the tagtagname
) for the new filename[ ! -z "$name" ]
- check if a new filename is not empty (i.e.<tagname>
was found and it had a value)
add a comment |Â
up vote
1
down vote
The right way with find
+ xmlstarlet
tools:
find . -type f -name "*.html" -exec sh -c
'name=$(xmlstarlet sel -t -v "//tagname" $1 2>/dev/null);
[ ! -z "$name" ] && echo mv "$1" "$1%%/*/$name.html"' _ ;
name
- variable which is assigned with a value (the contents of the tagtagname
) for the new filename[ ! -z "$name" ]
- check if a new filename is not empty (i.e.<tagname>
was found and it had a value)
add a comment |Â
up vote
1
down vote
up vote
1
down vote
The right way with find
+ xmlstarlet
tools:
find . -type f -name "*.html" -exec sh -c
'name=$(xmlstarlet sel -t -v "//tagname" $1 2>/dev/null);
[ ! -z "$name" ] && echo mv "$1" "$1%%/*/$name.html"' _ ;
name
- variable which is assigned with a value (the contents of the tagtagname
) for the new filename[ ! -z "$name" ]
- check if a new filename is not empty (i.e.<tagname>
was found and it had a value)
The right way with find
+ xmlstarlet
tools:
find . -type f -name "*.html" -exec sh -c
'name=$(xmlstarlet sel -t -v "//tagname" $1 2>/dev/null);
[ ! -z "$name" ] && echo mv "$1" "$1%%/*/$name.html"' _ ;
name
- variable which is assigned with a value (the contents of the tagtagname
) for the new filename[ ! -z "$name" ]
- check if a new filename is not empty (i.e.<tagname>
was found and it had a value)
edited Feb 17 at 17:51
answered Feb 17 at 17:46
RomanPerekhrest
22.4k12144
22.4k12144
add a comment |Â
add a comment |Â
up vote
1
down vote
With xmlstarlet:
xmlstarlet format --html teste.html | xmlstarlet select --html --template --value-of '//html/body/div/h1'
Output:
teste
I used xmlstarlet format --html teste.html
to fix your non valid html code.
add a comment |Â
up vote
1
down vote
With xmlstarlet:
xmlstarlet format --html teste.html | xmlstarlet select --html --template --value-of '//html/body/div/h1'
Output:
teste
I used xmlstarlet format --html teste.html
to fix your non valid html code.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
With xmlstarlet:
xmlstarlet format --html teste.html | xmlstarlet select --html --template --value-of '//html/body/div/h1'
Output:
teste
I used xmlstarlet format --html teste.html
to fix your non valid html code.
With xmlstarlet:
xmlstarlet format --html teste.html | xmlstarlet select --html --template --value-of '//html/body/div/h1'
Output:
teste
I used xmlstarlet format --html teste.html
to fix your non valid html code.
answered Feb 17 at 17:57
Cyrus
7,0362835
7,0362835
add a comment |Â
add a comment |Â
up vote
0
down vote
If tag is alone on the 8-th line, you have many way to pick it.
tag=$( awk NR==8 file )
tag=$( awk 'NR == 8 print ;' file )
where
NR
is number of record (line number)print
is implied action
or
tag=$(sed -n 8p file)
where
-n
will not echo line8p
print 8th line.
and many other.
as notted in comment, relaying on line number is risky. If file is a valid xml file, extracting tag would be easier and safest.
add a comment |Â
up vote
0
down vote
If tag is alone on the 8-th line, you have many way to pick it.
tag=$( awk NR==8 file )
tag=$( awk 'NR == 8 print ;' file )
where
NR
is number of record (line number)print
is implied action
or
tag=$(sed -n 8p file)
where
-n
will not echo line8p
print 8th line.
and many other.
as notted in comment, relaying on line number is risky. If file is a valid xml file, extracting tag would be easier and safest.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
If tag is alone on the 8-th line, you have many way to pick it.
tag=$( awk NR==8 file )
tag=$( awk 'NR == 8 print ;' file )
where
NR
is number of record (line number)print
is implied action
or
tag=$(sed -n 8p file)
where
-n
will not echo line8p
print 8th line.
and many other.
as notted in comment, relaying on line number is risky. If file is a valid xml file, extracting tag would be easier and safest.
If tag is alone on the 8-th line, you have many way to pick it.
tag=$( awk NR==8 file )
tag=$( awk 'NR == 8 print ;' file )
where
NR
is number of record (line number)print
is implied action
or
tag=$(sed -n 8p file)
where
-n
will not echo line8p
print 8th line.
and many other.
as notted in comment, relaying on line number is risky. If file is a valid xml file, extracting tag would be easier and safest.
answered Feb 17 at 17:30
Archemar
18.9k93366
18.9k93366
add a comment |Â
add a comment |Â
up vote
0
down vote
My final solution was the code below, combining two suggestions. Thank you, guys!
for file in *.html; do
tag=$(xmlstarlet format --html $file | xmlstarlet select --html --template --value-of '//html/body/div/h1')
mv "$file" "$tag.html"
done
It worked great for my files!
add a comment |Â
up vote
0
down vote
My final solution was the code below, combining two suggestions. Thank you, guys!
for file in *.html; do
tag=$(xmlstarlet format --html $file | xmlstarlet select --html --template --value-of '//html/body/div/h1')
mv "$file" "$tag.html"
done
It worked great for my files!
add a comment |Â
up vote
0
down vote
up vote
0
down vote
My final solution was the code below, combining two suggestions. Thank you, guys!
for file in *.html; do
tag=$(xmlstarlet format --html $file | xmlstarlet select --html --template --value-of '//html/body/div/h1')
mv "$file" "$tag.html"
done
It worked great for my files!
My final solution was the code below, combining two suggestions. Thank you, guys!
for file in *.html; do
tag=$(xmlstarlet format --html $file | xmlstarlet select --html --template --value-of '//html/body/div/h1')
mv "$file" "$tag.html"
done
It worked great for my files!
answered Feb 19 at 10:37
Leonardo Barichello
31
31
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f424830%2frename-a-html-file-based-on-the-content-of-a-tag%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
3
I suggest to use an XML/HTML parser (xmlstarlet, xmllint ...).
â Cyrus
Feb 17 at 17:23
Please add sample input.
â Gilles Quenot
Feb 17 at 17:28
you should never rely on a line number when dealing with XML/HTML data. Post the crucial tag name and its content
â RomanPerekhrest
Feb 17 at 17:30
Are you suggesting an edit your own post? Don't worry, the system is smart and the mods can merge your accounts. (Btw, using multiple accounts is allowed here, only misusing this is not (for example, upvoting your own post on your other account)).
â peterh
Feb 17 at 19:51
@peterh I'm afraid mods can't merge accounts. Leo, please request a merge of your two accounts by following the instructions here: unix.stackexchange.com/help/merging-accounts
â terdonâ¦
Feb 18 at 12:31