[gull] Afficher Lignes Impaires d'un fichier texte

Gerome Fournier jefke at free.fr
Tue Mar 7 20:21:27 CET 2006


Bonjour,

Anthony Assi wrote:
> Bonjour,
> 
> Comment est-ce que je pourrais afficher les lignes impaires d'un fichier 
> texte,
> sans passer par un script shell,
> plutot une combinaisons de commandes Shells ( cat -n, egrep -v, etc.. )

Par exemple avec awk:

Affichage de lignes impaires:

awk '{if (FNR % 2 == 1) {print;}}' filename

Afficahge de lignes paires:

awk '{if (FNR % 2 == 0) {print;}}' filename

-- 
Gerome Fournier
http://jefke.free.fr



More information about the gull mailing list