Latest web development tutorials

comando di Linux wc

Linux comando Daquan Linux comando Daquan

comando di Linux wc per contare le parole.

L'uso di comando wc siamo in grado di calcolare il numero di file di byte, parole, o il numero di colonne, se non specificare un nome file o un determinato nome del file è "-", il comando wc leggerà i dati dal dispositivo di input standard.

grammatica

wc [-clw][--help][--version][文件...]

parametri:

  • o --bytes o --chars -c mostrano solo pochi byte.
  • -l o --lines visualizzare solo il numero di colonne.
  • -w o --parole mostrano solo parole.
  • --help guida in linea.
  • --version informazioni sulla versione di visualizzazione.

Esempi

In caso di inadempienza, wc conta il numero di righe specificato di file, parole e byte. Comando è:

wc testfile 

Per visualizzare il contenuto del file di testfile, è possibile vedere:

$ cat testfile  
Linux networks are becoming more and more common, but scurity is often an overlooked  
issue. Unfortunately, in today’s environment all networks are potential hacker targets,  
fro0m tp-secret military research networks to small home LANs.  
Linux Network Securty focuses on securing Linux in a networked environment, where the  
security of the entire network needs to be considered rather than just isolated machines.  
It uses a mix of theory and practicl techniques to teach administrators how to install and  
use security applications, as well as how the applcations work and why they are necesary. 

Utilizzando i risultati statistici wc sono i seguenti:

$ wc testfile           # testfile文件的统计信息  
3 92 598 testfile       # testfile文件的行数为3、单词数92、字节数598 

Tra questi, le tre figure rappresentano il numero di byte del file testfile linee, parole e file.

Se si desidera più di un file allo stesso tempo informazioni statistiche, come le statistiche, mentre testfile, testfile_1, testfile_2, utilizzare il seguente comando:

wc testfile testfile_1 testfile_2   #统计三个文件的信息 

L'uscita è il seguente:

$ wc testfile testfile_1 testfile_2  #统计三个文件的信息  
3 92 598 testfile                    #第一个文件行数为3、单词数92、字节数598  
9 18 78 testfile_1                   #第二个文件的行数为9、单词数18、字节数78  
3 6 32 testfile_2                    #第三个文件的行数为3、单词数6、字节数32  
15 116 708 总用量                    #三个文件总共的行数为15、单词数116、字节数708 

Linux comando Daquan Linux comando Daquan