<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://forum.ubuntu-fr.org/extern.php?action=feed&amp;tid=523561&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / Extraire une chaine avec Grep...sed ...]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=523561</link>
		<description><![CDATA[Les sujets les plus récents dans Extraire une chaine avec Grep...sed ....]]></description>
		<lastBuildDate>Sat, 29 Dec 2012 12:29:23 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12020351#p12020351</link>
			<description><![CDATA[<p>remplace uniq par sort -u</p>]]></description>
			<author><![CDATA[dummy@example.com (Hizoka)]]></author>
			<pubDate>Sat, 29 Dec 2012 12:29:23 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12020351#p12020351</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12017851#p12017851</link>
			<description><![CDATA[<p>Bonjour,</p><div class="quotebox"><cite>tontonlogic #31 a écrit&#160;:</cite><blockquote><div><p>|uniq ne joue pas son rôle</p></div></blockquote></div><p>Le fichier d&#039;entrée doit être trié. Voici un extrait de <strong>man uniq</strong> :</p><div class="quotebox"><blockquote><div><p>Filter&#160; <strong>adjacent</strong>&#160; matching lines from INPUT (or standard input), writing to<br />&#160; &#160; &#160; &#160;OUTPUT (or standard output).</p><p>&#160; &#160; &#160; &#160;With no options, matching lines are merged to the first occurrence.</p></div></blockquote></div><p><span class="bbu">Ajouté</span> : Que vient faire <strong>./</strong> à la fin de la commande <strong>grep</strong> ? <strong>grep</strong> va parcourir l&#039;arborescence à partir du répertoire courant, mais ne va pas lire le résultat de <strong>strings</strong>.</p>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Sat, 29 Dec 2012 04:06:43 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12017851#p12017851</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12017041#p12017041</link>
			<description><![CDATA[<p>Merci, c&#039;est mieux. </p><div class="codebox"><pre><code>strings /home/moi/monrepertoire/* |grep -Ehiro &#039;([[:alnum:]_.-]+@[[:alnum:]_.-]+?\.[[:alpha:].]{2,6})&#039; ./ |uniq &gt; emails.txt</code></pre></div><p>Je rencontre encore deux problèmes: |uniq ne joue pas son rôle. J&#039;obtiens plusieurs fois le même mail.&#160; Et le dernier problème c&#039;est que string cherche bien dans un premier temps dans le répertoire&#160; /home/moi/monrepertoire/* puis sort de ce répertoire et cherche à la racine de mon disque. Une idée?</p>]]></description>
			<author><![CDATA[dummy@example.com (tontonlogic)]]></author>
			<pubDate>Fri, 28 Dec 2012 23:39:20 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12017041#p12017041</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12008781#p12008781</link>
			<description><![CDATA[<p>Man grep:</p><div class="quotebox"><blockquote><div><p>-h, --no-filename<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; Suppress the prefixing of file names on&#160; output.&#160; &#160;This&#160; is&#160; the<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; default&#160; when there is only one file (or only standard input) to<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; search.</p></div></blockquote></div>]]></description>
			<author><![CDATA[dummy@example.com (Haleth)]]></author>
			<pubDate>Fri, 28 Dec 2012 08:20:58 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12008781#p12008781</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12007051#p12007051</link>
			<description><![CDATA[<p>Salut,</p><p>Je relève ce post pour ne pas éparpiller. </p><br /><p>Pour butiner et extraire les email de tout un répertoire j&#039;utilise:</p><div class="codebox"><pre><code>strings /home/moi/monrepertoire/* |grep -Eiro &#039;([[:alnum:]_.-]+@[[:alnum:]_.-]+?\.[[:alpha:].]{2,6})&#039; ./ |uniq &gt; emails.txt</code></pre></div><p>Ca me sort bien les lignes dans mon fichier emails.txt.&#160; Toutefois j&#039;obtiens aussi le nom du fichier avant l&#039;email.<br />Comment l&#039;enlever? Les lignes ressemblent à ceci: </p><div class="codebox"><pre><code>./monrepertoire/index.html:pierre@domaine.fr
./monrepertoire/index.html:paul@domaine.fr
./monrepertoire/index.html:jacques@domaine.fr</code></pre></div><p>...</p>]]></description>
			<author><![CDATA[dummy@example.com (tontonlogic)]]></author>
			<pubDate>Thu, 27 Dec 2012 23:17:14 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12007051#p12007051</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=4844901#p4844901</link>
			<description><![CDATA[<p>le man bash est clair : &quot;Cet interpréteur de commandes est trop gros et trop lent.&quot;<br />c&#039;est connu, sur des gros fichiers, il faut privilégier sed, awk, perl, python...</p><p>j&#039;ai lu que c&#039;est à cause d&#039;algorithmes de lecture... je ne sais pas.</p>]]></description>
			<author><![CDATA[dummy@example.com (Watael)]]></author>
			<pubDate>Sun, 05 Jun 2011 14:40:15 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=4844901#p4844901</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=4844141#p4844141</link>
			<description><![CDATA[<p>Wow.&#160; Il faudra que j&#039;étudie le manuel bash de plus près!&#160; Watael pourrait utiliser [ &lt;-+,] comme séparateur de début et [ &gt;-+,] comme séparateur de fin d&#039;adresse email au lieu d&#039;un simple blanc.&#160; Cependant:</p><p>J&#039;ai essayé tout cela sur un fichier d&#039;un million de lignes, contenant 70% de lignes avec email et 30% sans.</p><p>La méthode sed:&#160; <strong>42.45s</strong> et <strong>41.33s</strong> si je remplace les [:alnum:] avec @ et [^@]</p><p>La méthode pur bash Watael: <strong>5:22.68s</strong></p><p>J&#039;ai tout fait deux fois pour éliminer des effets cache/tampons.&#160; Qui explique?</p><p>EDIT: temps exact<br />EDIT compris blanc échap</p>]]></description>
			<author><![CDATA[dummy@example.com (aduxas)]]></author>
			<pubDate>Sun, 05 Jun 2011 14:10:22 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=4844141#p4844141</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=4837201#p4837201</link>
			<description><![CDATA[<p>salut,</p><div class="codebox"><pre><code>while read line; do if [[ $line =~ .*\ ([^@]*@[^ ]*) ]]; then email=&quot;${BASH_REMATCH[1]/#[&gt;&lt;-+,]}&quot;; echo &quot;${email/%[&gt;&lt;-+,]}&quot;; fi; done &lt;&lt;&lt;&quot;$test&quot;
toto@gmail.com
leontine@yahoo.fr
titine@gmail.com
hgfhfg@yahoo.fr</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (Watael)]]></author>
			<pubDate>Sun, 05 Jun 2011 06:56:11 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=4837201#p4837201</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=4836651#p4836651</link>
			<description><![CDATA[<p>ba ouais...</p><div class="codebox"><pre><code>i=&quot;&lt;hgfhfg@yahoo.fr&gt;&quot;
i=${i/#[&gt;&lt;-+,]}
i=${i/%[&gt;&lt;-+,]}
=&gt; hgfhfg@yahoo.fr</code></pre></div><p>par exemple...</p>]]></description>
			<author><![CDATA[dummy@example.com (Hizoka)]]></author>
			<pubDate>Sun, 05 Jun 2011 04:18:00 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=4836651#p4836651</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=4836241#p4836241</link>
			<description><![CDATA[<div class="quotebox"><cite>Hizoka a écrit&#160;:</cite><blockquote><div><p>apres il faut voir pour traiter les adresses, genre virer les -,&gt;,;&gt;.... de fin de ligne et debut...</p></div></blockquote></div><p> Ah.&#160; Aussi en full bash? <img src="http://forum.ubuntu-fr.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></description>
			<author><![CDATA[dummy@example.com (aduxas)]]></author>
			<pubDate>Sun, 05 Jun 2011 00:48:10 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=4836241#p4836241</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=4835821#p4835821</link>
			<description><![CDATA[<p>avec du full bash <img src="http://forum.ubuntu-fr.org/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p><div class="codebox"><pre><code>test=&quot;Monsieur Toto Léon , toto@gmail.com, 5 rue qui tourne 47130 Le trou
Léontine Lajoie 25 Av du virage droit 46000 Levinquipique &lt;leontine@yahoo.fr&gt;
Madame Titine Léon - titine@gmail.com- 5 rue qui tourne 47130 Le trou
Léontimlkmlkne Lajoie 25 Av du virage droit 46000 kjhkjh &lt;hgfhfg@yahoo.fr&gt;&quot;

while read ligne
do
 tableau=(${ligne})
 for i in ${tableau[@]}; do [[ &quot;$i&quot; =~ @ ]] &amp;&amp; echo &quot;$i&quot;; done
done &lt;&lt;&lt; &quot;$test&quot;

=&gt; toto@gmail.com,
=&gt; &lt;leontine@yahoo.fr&gt;
=&gt; &lt;letitine@gmail.com-
=&gt; &lt;hgfhfg@yahoo.fr&gt;</code></pre></div><p>apres il faut voir pour traiter les adresses, genre virer les -,&gt;,;&gt;.... de fin de ligne et debut...</p>]]></description>
			<author><![CDATA[dummy@example.com (Hizoka)]]></author>
			<pubDate>Sat, 04 Jun 2011 23:00:06 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=4835821#p4835821</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=4835791#p4835791</link>
			<description><![CDATA[<p>peux tu donner plus de 2 ex stp ?</p><p>qu&#039;on voit un peu les differents cas possibles.</p>]]></description>
			<author><![CDATA[dummy@example.com (Hizoka)]]></author>
			<pubDate>Sat, 04 Jun 2011 22:54:33 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=4835791#p4835791</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=4835701#p4835701</link>
			<description><![CDATA[<p>Si jamais le fichier contient des lignes sans adresse email, on peut les virer avant:</p><div class="codebox"><pre><code>sed &#039;/@/!d;s/.*\(\&lt;[-_[:alnum:]]\+@[[:alnum:]_]\+\.[[:alpha:]]\+\).*/\1/&#039; mon_fichier</code></pre></div><p>Comme tout le monde semble parti, encore ceci:&#160; il faut commencer l&#039;expression de l&#039;adresse email avec un délimiteur de début de mot \&lt; sinon la chaîne générale .* avale tout jusqu&#039;au dernier caractère avant l&#039;arobase; le multiplicateur \+ en effet se contente d&#039;un seul caractère.</p>]]></description>
			<author><![CDATA[dummy@example.com (aduxas)]]></author>
			<pubDate>Sat, 04 Jun 2011 22:40:11 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=4835701#p4835701</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=4834441#p4834441</link>
			<description><![CDATA[<p>Il y a des adresses email avec des _ et des chiffres dans le domaine!</p><div class="codebox"><pre><code>sed &#039;s/.*\(\&lt;[-_[:alnum:]]\+@[[:alnum:]_]\+\.[[:alpha:]]\+\).*/\1/&#039; mon_fichier</code></pre></div><p>J&#039;explique:<br />Disons qu&#039;un mot, c&#039;est au moins un caractère alphanumérique, tiret ou underscore, et une extension une suite de lettres.&#160; Je considère une adresse la forme mot@mot.extension.<br />Je remplace truc-adresse-truc par adresse.&#160; J&#039;ai donc mis adresse entre des délimiteurs \( et \) et j&#039;y fais référence avec \1.&#160; Il faut mettre le tiret au début sinon sed pense qu&#039;il sert à définir une série comme a-z.</p>]]></description>
			<author><![CDATA[dummy@example.com (aduxas)]]></author>
			<pubDate>Sat, 04 Jun 2011 20:58:46 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=4834441#p4834441</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Extraire une chaine avec Grep...sed ...]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=4834031#p4834031</link>
			<description><![CDATA[<p>regarde</p><div class="codebox"><pre><code>info sed</code></pre></div><p>et fais une recherche sur <em>greedy</em></p>]]></description>
			<author><![CDATA[dummy@example.com (Watael)]]></author>
			<pubDate>Sat, 04 Jun 2011 20:15:54 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=4834031#p4834031</guid>
		</item>
	</channel>
</rss>
