Latest web development tutorials

comando di Linux TR

Linux comando Daquan Linux comando Daquan

comando di Linux TR per convertire il file o eliminare i caratteri.

dispositivo di input comando tr per leggere i dati dalla norma, dopo una serie di traduzioni, i risultati al dispositivo di uscita standard.

grammatica

tr [-cdst][--help][--version][第一字符集][第二字符集]  
tr [OPTION]…SET1[SET2] 

Descrizione Parametro:

  • -c, --complement: set di caratteri anti-elettorale. Questo non è in linea con parte SET1, e la parte restante della non conformità prima della conversione
  • -d, --delete: eliminare l'istruzione carattere
  • Ridotto ripetuto continuamente singolo carattere per il carattere specificato: -s, --squeeze-repeats
  • -t, --truncate-SET1: tagliare SET1 campo specificato, in modo da impostare la lunghezza pari a SET2
  • --help: visualizza le informazioni sull'utilizzo del programma
  • --version: Mostra informazioni sulla versione del programma stesso

Gamma di set di caratteri:

  • \ Valore di carattere ottale NNN NNN (da 1 a 3 valore ottale del carattere)
  • \\ Barra rovesciata
  • \ A Ctrl-G Suonerie
  • \ B Ctrl-H Backspace
  • \ F Ctrl-L alimentazione Traveling
  • \ N Ctrl-J nuova riga
  • \ R Ctrl-M Enter
  • \ Tasto tab T Ctrl-I
  • \ V CTRL-X schede orizzontali
  • CAR1-CAR2: I caratteri vanno da CAR1 a denominazione CAR2 dell'intervallo specificato in base ordine ASCII solo dal piccolo al grande, non discendente.
  • [CHAR *]: Questa è l'impostazione specifica SET2, la funzione si ripete il carattere specificato per la stessa lunghezza, per quanto SET1
  • [CAR * REPEAT]: Questa è l'impostazione specifica SET2, la funzione viene ripetuto un determinato numero di caratteri per impostare REPEAT (REPEAT figure raccolto 8 sistema binario calcolato all'avvio zero)
  • [: Alnum:]: tutti i caratteri alfabetici e numeri
  • [: alpha:]: tutti i caratteri alfabetici
  • [: Blank:]: tutto lo spazio orizzontale
  • [: Cntrl:]: tutti i caratteri di controllo
  • [: Digit:]: Tutti i dati
  • [: Graph:]: tutti i caratteri stampabili (non compresi gli spazi)
  • [: lower:]: tutte le lettere minuscole
  • [: Stampa:]: tutti i caratteri stampabili (spazi inclusi)
  • [: punct:]: Tutti i caratteri di punteggiatura
  • [: Space:]: tutti gli spazi orizzontali e verticali
  • [: upper:]: tutte le lettere maiuscole
  • [: Xdigit:]: Tutti sistema numerico esadecimale
  • [= CHAR =]: tutto coerente con il carattere specificato (il segno di uguale nella CAR, rappresentano il tuo personaggio personalizzabile)

Esempi

Il testfile file in tutte le lettere minuscole a maiuscole, quindi, utilizzare il seguente comando:

cat testfile |tr a-z A-Z 

il file testfile è formulato come segue:

$ cat testfile         #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. 

Dopo aver utilizzato il comando tr per convertire il caso di dare il seguente risultato:

$ cat testfile | tr a-z A-Z #转换后的输出  
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,  
FROM 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. 

parametri di conversione caso per realizzare, può anche [:: inferiore] [superiore]. Ad esempio, utilizzare il seguente comando:

cat testfile |tr [:lower:] [:upper:] 

L'uscita è il seguente:

$ cat testfile | tr [:lower:] [:upper:] #转换后的输出  
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,  
FROM 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. 

Linux comando Daquan Linux comando Daquan