Bash awk come stampare righe specifiche

Esempi di codice

2
0

bash awk come stampare righe specifiche

# Basic syntax:
awk 'row condition goes here {outcome if true goes here}' input_file

# Example usage:
awk 'NR >= 50 && NR <= 100 {print $23, $42}' input_file
# Where
#	- NR is the row number being processed 
#	- This command prints the 23rd and 42nd fields of the input_file for
# 		rows 50-100. 

# More complex example usage:
awk 'BEGIN {OFS="\t"}; {if(NR >= 2 && NR <= 7) print $4; else if (NR == 8) print $0}' input_file
# BEGIN {OFS="\t"}; sets the output field delimiter to tab
# The rest of the statement prints the 4th field of the input_file for
# rows 2-7 and prints all fields for row 8. 

Pagine correlate

Pagine di esempio simili

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
English
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................