2
rated 0 times
[
2]
[
0]
/ answers: 1 / hits: 1012
/ 3 Years ago, wed, october 13, 2021, 2:19:47
I need to combine the first value ($1
) of consecutive rows if their fourth value ($4
) is the same (I-PER
).
I managed to filter the values I need simply using awk:
awk ' ($4 == "I-PER") {printf $1; printf "
" }
I also found how to merge rows with duplicate column values but not consecutive ones.
Example (Input):
Comandante comandante NP00000 I-PER
de de SPS00 I-PER
la el DA0FS0 I-PER
Guardia guardia NP00000 I-PER
Civil civil NP00000 I-PER
Pamplona pamplona NP00000 I-LOC
Poblador poblador NP00000 I-PER
Example (Output):
Comandante de la Guardia Civil
Poblador
More From » command-line