Awk

De Linuxmemo.

(Différences entre les versions)
(Page créée avec « Catégorie:Commandes awk 'instructions' files awk -f script files »)
Ligne 3 : Ligne 3 :
  awk -f script files
  awk -f script files
 +
 +
Awk, in the usual case, interprets each input line as a record and each word on that line, delimited byspaces or tabs, as a field. (These defaults can be changed.) One or more consecutive spaces or tabs count
 +
as a single delimiter. Awk allows you to reference these fields, in either patterns or procedures. $0
 +
represents the entire input line. $1, $2, ... refer to the individual fields on the input line.
 +
 +
awk '{ print $1 }' list
 +
John
 +
Alice
 +
Orville

Version du 12 avril 2018 à 14:13

awk 'instructions' files
awk -f script files

Awk, in the usual case, interprets each input line as a record and each word on that line, delimited byspaces or tabs, as a field. (These defaults can be changed.) One or more consecutive spaces or tabs count as a single delimiter. Awk allows you to reference these fields, in either patterns or procedures. $0 represents the entire input line. $1, $2, ... refer to the individual fields on the input line.

awk '{ print $1 }' list
John
Alice
Orville
Outils personnels