<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
I would like to use a perl script wrote by a friend, I open a post
about it on the French Ubuntu forum :
<a class="moz-txt-link-freetext" href="http://forum.ubuntu-fr.org/viewtopic.php?pid=18895781">http://forum.ubuntu-fr.org/viewtopic.php?pid=18895781</a><br>
But now it's really difficult to find a solution. For this reason I
decided to wrote you.<br>
I would like to change a text like that :<br>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<span style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(253, 252, 253);"><br>
Tobit # (name of the book)</span><br style="color: rgb(0, 0, 0);
font-family: Arial, sans-serif; font-size: 14px; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 19.0400009155273px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(253, 252,
253);">
<span style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(253, 252, 253);">1
# (chapter, est suivi d'un retour à la ligne(\n))</span><br
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(253, 252, 253);">
<span style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(253, 252, 253);">1
Histoire de Tobit, fils de Tobiel, ...<span
class="Apple-converted-space"> </span></span><br style="color:
rgb(0, 0, 0); font-family: Arial, sans-serif; font-size: 14px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 19.0400009155273px; orphans:
auto; text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(253, 252,
253);">
<span style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(253, 252, 253);">2
Aux jours de Salmanasar, ...<span class="Apple-converted-space"> </span></span><br
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(253, 252, 253);">
<span style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(253, 252, 253);">3
Moi, Tobit... <br>
4 Dans ma jeunesse....<span class="Apple-converted-space"> </span></span><br
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(253, 252, 253);">
<span style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(253, 252, 253);">...</span><br
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(253, 252, 253);">
<span style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(253, 252, 253);">64...</span><br
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(253, 252, 253);">
<span style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(253, 252, 253);">2
# new chapter</span> with \n<br style="color: rgb(0, 0, 0);
font-family: Arial, sans-serif; font-size: 14px; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 19.0400009155273px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(253, 252,
253);">
<span style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(253, 252, 253);">1
...<span class="Apple-converted-space"> </span></span><br
style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(253, 252, 253);">
<span style="color: rgb(0, 0, 0); font-family: Arial, sans-serif;
font-size: 14px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(253, 252, 253);">2...<br>
<big>To imp text, the outpout text file is empty...<br>
The perl script:<br>
<br>
</big></span><br>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<div class="codebox" style="font-family: Consolas, 'Lucida Console',
'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', monospace;
font-size: 1.1em; max-height: 26em; border: 1px solid rgb(173,
144, 96); color: white; overflow: auto; margin: 9px 0.2em 1em;
padding: 0.3em 0.5em; border-top-left-radius: 5px;
border-top-right-radius: 5px; border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal; line-height:
19.0400009155273px; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(51, 51, 51);">
<pre class="vscroll" style="margin: 0px; white-space: pre;"><code>#!/usr/bin/perl
#ouverture du fichier à modifier
$entree = $ARGV[0];
open(FICLOC, $entree);
if ( $entree =~ /(.*)\.[^\.]+/ ) {
$book_title = $1;
} else {
$book_title = $entree;
}
#ouverture du fichier modifié
$ext = "txt"; #Insere ici l'extension que tu souhaites pour ton fichier
open(FICOUT, ">", "$book_title_out.$ext");
# Par la suite, je suppose que le titre est dans la variable $book_title
while ($line = <FICLOC>){
# Detection de chapitre
if ($line =~ '/^(\d+)\s*$/') {
$n_chapter = $1;
}
## Detection de versets
if ($line =~ '/^(\d+)\s+(.+)$/') {
$n_verse = $1;
$text_verse = $2;
$formatted_text = "\$\$\$book_title$n_chapter:$n_verse\n$text_verse";
# Ecriture de cette ligne dans le fichier texte
print FICOUT "$formatted_text\n";
}
}</code></pre>
</div>
Maybe you have already a script for this job?<br>
Thanks you for your help,<br>
<br>
Br Cyrille<br class="Apple-interchange-newline">
<pre class="moz-signature" cols="72">--
L'Africain</pre>
</body>
</html>