<?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=1122741&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / Supprimer doublon avec awk]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=1122741</link>
		<description><![CDATA[Les sujets les plus récents dans Supprimer doublon avec awk.]]></description>
		<lastBuildDate>Fri, 30 Nov 2012 19:48:24 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  Supprimer doublon avec awk]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11694851#p11694851</link>
			<description><![CDATA[<p>Dans ta commande awk, $NF veut dire:&#160; <em>le contenu</em> du dernier champs de la ligne courante.</p>]]></description>
			<author><![CDATA[dummy@example.com (aduxas)]]></author>
			<pubDate>Fri, 30 Nov 2012 19:48:24 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11694851#p11694851</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Supprimer doublon avec awk]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692451#p11692451</link>
			<description><![CDATA[<p>Merci nesthib pour l&#039;explication, mais ma remarque était juste anecdotique.</p>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Fri, 30 Nov 2012 15:50:40 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692451#p11692451</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Supprimer doublon avec awk]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692401#p11692401</link>
			<description><![CDATA[<p>@pingouinux : c&#039;est un grand classique awk qui utilise une syntaxe idiomatique <img src="http://forum.ubuntu-fr.org/img/smilies/wink.png" width="15" height="15" alt="wink" /><br />Pour l&#039;explication, on créé un tableau « _ » qui enregistre le nombre de fois où une ligne est trouvée « _[$0]++ », par défaut si aucune commande n&#039;est lancée awk affiche la ligne actuelle SI le retour d&#039;une action (ici, afficher le contenu de « _[$0] ») est vrai (ici, « _[$0]++ » n&#039;est vrai que si une ligne a déjà été vue, donc « !_[$0]++ » n&#039;est vrai que si une ligne n&#039;a jamais été vue).</p><p>@Bat_Tuc : awk fait du traitement par bloc et par champ, par défaut un bloc est une ligne et un champ est un mot. Donc par défaut, oui, awk applique ton code à chaque ligne.</p>]]></description>
			<author><![CDATA[dummy@example.com (nesthib)]]></author>
			<pubDate>Fri, 30 Nov 2012 15:47:09 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692401#p11692401</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Supprimer doublon avec awk]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692211#p11692211</link>
			<description><![CDATA[<p>@nesthib #5 : Joli, mais il y a de quoi dérouter le néophyte…</p>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Fri, 30 Nov 2012 15:27:53 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692211#p11692211</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Supprimer doublon avec awk]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692161#p11692161</link>
			<description><![CDATA[<p>Enfaite j&#039;ai vraiment du mal avec awk. Je pensais qu&#039;il faisait du traitement sur tout le fichier.<br />Alors que si j&#039;ai bien compris il fait le traitement ligne par ligne c&#039;est ca ? il va applique mon code a chaque ligne ? Ca explique donc pourquoi i vaut toujours 1 j&#039;ai que un seul champ par ligne ..</p>]]></description>
			<author><![CDATA[dummy@example.com (Bat_Tuc)]]></author>
			<pubDate>Fri, 30 Nov 2012 15:18:13 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692161#p11692161</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Supprimer doublon avec awk]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692131#p11692131</link>
			<description><![CDATA[<div class="codebox"><pre><code>awk &#039;!_[$0]++&#039; fichier</code></pre></div><p>(si une ligne n&#039;a pas déjà été trouvée on l&#039;affiche)</p><p>Comme pingouinux, j&#039;avoue que je comprends mal ton raisonnement du premier message.</p>]]></description>
			<author><![CDATA[dummy@example.com (nesthib)]]></author>
			<pubDate>Fri, 30 Nov 2012 15:16:19 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692131#p11692131</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Supprimer doublon avec awk]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692111#p11692111</link>
			<description><![CDATA[<div class="quotebox"><blockquote><div><p>mais pourquoi mon awk ne marchait pas&#160; ?</p></div></blockquote></div><p>Il ne faut déjà pas de <strong>$NF</strong> sur cette ligne, qui doit être :</p><div class="codebox"><pre><code>for (i=1;i&lt;=NF;i++)</code></pre></div><p><span class="bbu">Remarque</span> : Le <strong>awk</strong> serait plus propre ainsi :</p><div class="codebox"><pre><code>awk &#039;{………}&#039; WhoIsOnline</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Fri, 30 Nov 2012 15:15:46 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692111#p11692111</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Supprimer doublon avec awk]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692011#p11692011</link>
			<description><![CDATA[<p>j&#039;ai un seul mot par ligne. L&#039;ordre importe peu.<br />ta réponse repond donc a mon besoin, mais pourquoi mon awk ne marchait pas&#160; ? <img src="http://forum.ubuntu-fr.org/img/smilies/sad.png" width="15" height="15" alt="sad" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Bat_Tuc)]]></author>
			<pubDate>Fri, 30 Nov 2012 15:04:59 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11692011#p11692011</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  Supprimer doublon avec awk]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11691971#p11691971</link>
			<description><![CDATA[<p>Bonjour,</p><div class="quotebox"><blockquote><div><p>Voila j&#039;ai un fichier ( WhoIsOnline) ou sur chaque ligne apparait un mot.</p></div></blockquote></div><p>Peux-tu préciser ? S&#039;il n&#039;y a qu&#039;un mot par ligne, inutile de passer en revue les champs de la ligne.<br />Si c&#039;est bien le cas, et si l&#039;ordre importe peu :</p><div class="codebox"><pre><code>sort -bu WhoIsOnline &gt;WhoIsOnline.new</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (pingouinux)]]></author>
			<pubDate>Fri, 30 Nov 2012 15:02:09 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11691971#p11691971</guid>
		</item>
		<item>
			<title><![CDATA[Supprimer doublon avec awk]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=11691831#p11691831</link>
			<description><![CDATA[<p>Voila j&#039;ai un fichier ( WhoIsOnline) ou sur chaque ligne apparait un mot.<br />j&#039;aimerais supprimer les doublons or ce que j&#039;ai fais ne marche pas ..<br />voila ce que j&#039;ai </p><div class="codebox"><pre><code>cat WhoIsOnline |
awk &#039;{
for (i=1;i&lt;=$NF;i++)
{
        nb=0
        for(j=1;j&lt;i;j++) { # je verifie si tous les champs d&#039;avant sont differents
                if ($i == $j) nb++
        }
        if(nb==0) printf $i
}
}&#039;</code></pre></div><p>apres divers test j&#039;ai l&#039;impression que mon i reste a 1 ...</p>]]></description>
			<author><![CDATA[dummy@example.com (Bat_Tuc)]]></author>
			<pubDate>Fri, 30 Nov 2012 14:49:35 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=11691831#p11691831</guid>
		</item>
	</channel>
</rss>
