Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
Sum columns and show totals with label with AWK

I have a file with:

1 Inicio
1 Fin
1 Starting
1 Ending
2 Inicio
2 Fin
2 Starting
2 Ending
6 OK
4 OK

But I need

3 Inicio
3 Fin
3 Starting
3 Ending
10 OK

I try with

awk '{ sum+=$1} END {print "Total " sum}' /myfile.txt

But this returned the total of coincidences. I appreciate your help .

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use awk like this:

awk '{sums[$2] += $1} END{for (i in sums) print sums[i], i}' file

3 Inicio
3 Starting
3 Fin
3 Ending
10 OK
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda