wc en version plus intelligente
This commit is contained in:
parent
1c8a6574dd
commit
d5c732de90
85 changed files with 12 additions and 17 deletions
PERL_Language
c
apres.ccd.cchrono.ccronbis.ceko.ceko2.cexoPointeurs.cfunction.clirecharl.cmatrice1.cmatrice2.cmini_shell.cminmax.cminuscule.cmiroir.cmonswap.cmultiChrono.cpalindrome.cprintenv.cskel_getopts.csqueeze.cstrdup.cstrdup2.cswapp.ctestargs.cvoir.c
semaphores_manuel_exemples
Exemple_curses
Exemples_semaphores
FileeDeMessage
essaiCurses.pdfexercice_rw
Makefileconsommateur.cconsommateur.hconstantes.hglobal.cproducteur.cproducteur.hrapportsema.csema.htypes.h
ipc_shm_posix.cmanuel_2009.pdfwtest6.c.pdfweechat_plugins
wordcount.cperl
|
@ -1,17 +0,0 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# This script displays the number of lines in a file
|
||||
|
||||
use strict;
|
||||
|
||||
die "un argument svp ! " if !defined ($ARGV[0]);
|
||||
|
||||
my $i=0;
|
||||
open(P,"< $ARGV[0]") || die "erreur ouverture $!";
|
||||
|
||||
while (<P>)
|
||||
{
|
||||
$i++;
|
||||
}
|
||||
close(P);
|
||||
print "nb de lignes = $i \n";
|
12
perl/wc.pl
Executable file
12
perl/wc.pl
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# Utilisation : wc.pl fichier
|
||||
|
||||
open(F, "<$ARGV[0]") || die "Problème d'ouverture de fichier ! ";
|
||||
|
||||
$i = 0 ;
|
||||
$i++ while(<F>);
|
||||
|
||||
close(F);
|
||||
|
||||
print "Nombre de lignes : $i \n";
|
Loading…
Add table
Reference in a new issue