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 "\n" }
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
'
in theawk
command here? I hesitate to just correct it because of Please don't correct commands in questions unless you are sure the mistake is not the source of the problem… – dessert Apr 13 '18 at 8:21