Re: using awk for selective printing, and adding a new line
> -Original Message- > From: j...@jgcomp.com > Sent: Mon, 09 May 2016 18:45:30 -0400 > To: wingat...@inbox.com > Subject: Re: using awk for selective printing, and adding a new line > > On Mon, May 09, 2016 at 02:26:07PM -0800, Antonio Olivares wrote: >> >> >>> It would be much easier to leave it as one field per line. >>> >>> >>> awk ' >>> BEGIN { f[1] = 4; f[2] = -14 >>> f[3] = f[4] = f[5] = f[6] = f[7] = f[8] = f[9] = f[10] = 3 >>> } >>> { printf ("%*s%c", f[NR%10], $0, NR%10 ? " " : "\n") } >>> ' $1 >>> >>> -- >> >> Dear Jon, >> >> I like your solution, but I get different output: >> >> $ awk ' BEGIN { f[1] = 4; f[2] = -14 f[3] = f4 = f[5] = f[6] = f[7] = >> f[8] = f[9] = f[10] = 3 } { printf ("%*s%c",f[NR%10], $0, NR%10 ? " " : >> "\n") }' tablagr2.dat > > Notice my BEGIN line is broken into 2 lines. If you want to join > them you must put a semicolon after the "-14". > >> awk: syntax error at source line 1 >> context is >> BEGIN { f[1] = 4; f[2] = -14 f[3] >>> = <<< f4 = f[5] = f[6] >> = f[7] = f[8] = f[9] = f[10] = 3 } { printf ("%*s%c",f[NR%10], $0, NR%10 >> ? " " : "\n") } >> awk: illegal statement at source line 1 >> >> $ awk ' BEGIN { f[1] = 4; f[2] = -14; f[3] = f4 = f[5] = f[6] = f[7] = >> f[8] = f[9] = f[10] = 3 } { printf ("%*s%c",f[NR%10], $0, NR%10 ? " " : >> "\n") }' tablagr2.dat > > Ok, you did that. > >> >> Pos.Equipo JJ JG JE JP GF GC DIF >> PTS1Monterrey 17 12 1 4 38 23 >> 15 37 2Pachuca 17 8 6 3 31 16 >> 15 30 3 Leon 17 9 3 5 29 >> 19 10 30 4 America 17 8 5 4 >> 34 22 12 29 5 Chivas 17 7 7 >> 3 26 16 10 28 6 Morelia 17 8 >> 4 5 25 24 1 28 7 Santos 17 >> 8 3 6 22 20 2 27 8 Tigres >> 17 6 6 5 29 19 10 24 9 >> CruzAzul 17 5 7 5 25 24 1 22 >> 10 Pumas17 5 7 5 23 24 -1 >> 22 11 Toluca 17 5 7 5 20 21 >> -1 22 12 Puebla 17 5 7 5 21 >> 26 -5 22 13 ClubQueretaro17 5 4 >> 8 21 26 -5 19 14 ClubTijuana 17 >> 3 9 5 17 26 -9 18 15 Atlas >> 17 3 5 9 18 26 -8 14 16 >> Dorados 17 4 2 11 18 32 -1414 >> 17 Veracruz17 2 8 7 18 34 >> -16 14 18 ChiapasFC 17 3 3 11 >> 16 33 -17 12 >> $ >> >> $ awk ' BEGIN { f[1] = 4; f[2] = -14; f[3] = f4 = f[5] 9] = f[10] = 3 } >> { printf ("%*s%c",f[NR%10], $0, NR%10 ? " " : "\n") }' >> tablageneral20160509.dat >> >> >> to get the nice output I have to do it in two steps, >> 1) copy the contents of the website to a file, then >> 2) run/pipe the command to >> awk '{printf("%s ",$0)}' filename > newfilename >> > > My program should be run using the data from 1), > i.e. > Pos. > Equipo > JJ > JG > ... > Cruz Azul > 17 > ... > >> >> The names are in two, Cruz Azul, combined into Cruz Azul, Chiapas FC -> >> ChiapasFC, Club Tijuana, Club Queretaro, I have to combine them into 1 >> so the data can format nicely. If the commands could be combined to do >> it in one shot, it would be nice, but the names will be a problem. > > You don't have to squish them. > >> >> The data is from : >> http://www.mediotiempo.com/tabla_general.php?id_liga=1&id_torneo=591 >> >> I select copy the data and paste it into a file, then I have to remove >> the "\n" and then take the 10 items per line. It looks easy, but it >> takes some time. >> > > I just cut and pasted that data into a file and ran my program on it. > There were no column headings, but you can add that in the BEG
Re: using awk for selective printing, and adding a new line
> -Original Message- > From: j...@jgcomp.com > Sent: Mon, 09 May 2016 14:49:50 -0400 > To: wingat...@inbox.com > Subject: Re: using awk for selective printing, and adding a new line > > On Mon, May 09, 2016 at 08:24:54AM -0800, Antonio Olivares wrote: >> Dear folks, >> >> I have found numerous guides using awk to format stats. I can get stats >> from a website, but when I paste them they get pasted one per line, I >> can get them to one line using awk '{printf("%s ",$0)}' and the filename >> here, but what I want to do is to get the first 11 records and print out >> a new line "\n", then get the next 11 record and get new line "\n" >> >> I get the data from mediotiempo.com, >> >> data: >> >> Pos. EquipoJJ JG JE JP GF GC >> DIFPTS 1 Monterrey 17 12 1 4 38 >> 23 15 37 2 Pachuca 17 8 6 3 >> 31 16 15 30 3 León17 9 3 5 >> 29 19 10 30 4 América 17 8 5 >> 4 34 22 12 29 5 Chivas 17 7 7 >> 3 26 16 10 28 6Morelia 17 8 >> 4 5 25 24 1 28 7Santos 17 8 >> 3 6 22 20 2 27 8Tigres 17 >> 6 6 5 29 19 10 24 9Cruz Azul >> 17 5 7 5 25 24 1 22 10 Pumas >> 17 57 5 23 24 -1 22 11 Toluca >> 17 57 5 20 21 -1 22 12 Puebla >> 17 57 5 21 26 -5 22 13 Club >> Querétaro 17 5 4 8 21 26 -5 >> 19 14 Club Tijuana 17 3 9 5 17 26 >> -9 18 15 Atlas 17 35 9 18 26 >> -8 14 16 Dorados 17 42 11 18 >> 32 -14 14 17 Veracruz17 28 7 >> 18 34 -16 14 18 Chiapas FC 17 33 >> 11 16 33 -17 12 >> >> to >> >> Pos Equipo JJ JG JE JP GF GC DIF PTS >> 1 Monterrey 16 12 1 3 37 21 16 37 >> 2 America 16 8 4 4 33 21 12 28 >> 3 Pachuca 16 7 6 3 29 15 14 27 >> 4 Leon16 8 3 5 28 19 9 27 >> 5 Santos 16 8 3 5 22 19 3 27 >> 6 Chivas 16 6 7 3 25 16 9 25 >> 7 Morelia 16 7 4 5 23 23 0 25 >> 8 CruzAzul16 5 7 4 25 21 4 22 >> 9 Tigres 16 5 6 5 26 19 7 21 >> 10 Pumas 16 5 6 5 22 23 -1 21 >> 11 Toluca 16 4 7 5 18 20 -2 19 >> 12 ClubQueretaro 16 5 4 7 20 23 -3 19 >> 13 Puebla 16 4 7 5 18 25 -7 19 >> 14 ClubTijuana 16 3 8 5 17 26 -9 17 >> 15 Dorados 16 4 2 10 18 31 -13 14 >> 16 Veracruz16 2 8 6 17 32 -15 14 >> 17 Atlas 16 3 4 9 18 26 -8 13 >> 18 ChiapasFC 16 3 3 10 15 31 -16 12 >> >> using a sed command. >> >> I have parts of commands as follows: >> >> #!/bin/sh >> >> # Check for arguments >> if [ $# -eq 0 ]; then >> echo "Usage: $(basename $0) filename" >> exit 1 >> fi >> >> if [ ! -f $1 ]; then >> echo "File "$1" doesn't exist!" >> exit 0 >> fi >> >> awk ' >> >> NR == 1 { >> printf "%2s %-14s %3s %3s %3s %3s %3s %3s %3s %3s \n", >> "Pos", "Equipo", "JJ", "JG", "JE", "JP", "GF", "GC" , >> "DIF", "PTS" >> } >> >> NR >= 2 { >> printf "%2d %-14s %3d %3d %3d %3d %3d %3d %3d %3d \n", >> $1, $2, $3, $4, $5, $6, $7, $8, $9, $10 '\n' >> }' $1 >> >> but it just prints the first line and that is it because it treats the >> data as a single line. If that is possible otherwise I will have to do >> it manually. >> >> Best regards, >> >> >> Antonio >> > > It would be much easier to leave it as one field per line. > > > awk ' > BEGIN { f[1] = 4; f[2] = -14 > f[3] =
Re: using awk for selective printing, and adding a new line
On Mon, May 09, 2016 at 11:50:38AM -0800, Antonio Olivares wrote: > > >> From: ad+li...@uni-x.org > >> Sent: Mon, 9 May 2016 20:47:49 +0200 > >> To: users@lists.fedoraproject.org > >> Subject: Re: using awk for selective printing, and adding a new line > >> > >> Am 09.05.2016 um 18:24 schrieb Antonio Olivares: > >>> Dear folks, > >>> > >>> I have found numerous guides using awk to format stats. I can get > >>> stats > >>> from a website, but when I paste them they get pasted one per line, > >>> > >>> awk ' > >>> > >>> NR == 1 { > >>> printf "%2s %-14s %3s %3s %3s %3s %3s %3s %3s %3s \n", > >>> "Pos", "Equipo", "JJ", "JG", "JE", "JP", "GF", "GC" , > >>> "DIF", "PTS" > >>> } > >>> > >>> NR >= 2 { > >>> printf "%2d %-14s %3d %3d %3d %3d %3d %3d %3d %3d \n", > >>> $1, $2, $3, $4, $5, $6, $7, $8, $9, $10 '\n' > >>> }' $1 > >>> > >>> but it just prints the first line and that is it because it treats the > >>> data as a single line. If that is possible otherwise I will have to do > >>> it manually. > >>> > >>> Best regards, > >>> > >>> > >>> Antonio > >> > >> > >> If you manage that the club names are always single fields of a > >> reasonable length, then > >> > >> awk '{ for (i = 1; i <= NF; i++) if (i % 10) printf "%s\t", $i; else > >> printf "%s\n", $i }' $yourinputfile > >> > >> does what you want. > >> > > > > It is getting close but some formatting is messing it up > > I tried > > > > $ awk 'ORS=NR%10?" ":"\n"' $filename > > > > it looked like it was going to work, but then in the first line, the PTS > > and the 1 got tangled up. Thank you for your insight it is close. I > > might need to use tr -d '\n' filename and pipe this and it could work. > > > > Best Regards, > > > > > > Antonio > > > > awk '{ for (i = 1; i <= NF; i++) if (i % 10) printf "%s\t", $i; else printf > "%s\n", $i }' > > worked :) > > Dear folks, > > I saw a mistake. The command worked, I saw that the names were split into > two and that messed things up. By fixing the names into one, the command > works. Thank you very much for your help. > > Best Regards, > If you leave the data as one field per line you can avoid squishing the team names and not depend on tabs for alignment. awk ' BEGIN { f[1] = 4; f[2] = -14 f[3] = f[4] = f[5] = f[6] = f[7] = f[8] = f[9] = f[10] = 3 } { printf ("%*s%c", f[NR%10], $0, NR%10 ? " " : "\n") } ' -- Jon H. LaBadie jo...@jgcomp.com -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: http://lists.fedoraproject.org/admin/lists/users@lists.fedoraproject.org Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
Re: using awk for selective printing, and adding a new line
> -Original Message- > From: wingat...@inbox.com > Sent: Mon, 9 May 2016 11:39:56 -0800 > To: users@lists.fedoraproject.org > Subject: Re: using awk for selective printing, and adding a new line > > > >> -Original Message- >> From: ad+li...@uni-x.org >> Sent: Mon, 9 May 2016 20:47:49 +0200 >> To: users@lists.fedoraproject.org >> Subject: Re: using awk for selective printing, and adding a new line >> >> Am 09.05.2016 um 18:24 schrieb Antonio Olivares: >>> Dear folks, >>> >>> I have found numerous guides using awk to format stats. I can get >>> stats >>> from a website, but when I paste them they get pasted one per line, I >>> can get them to one line using awk '{printf("%s ",$0)}' and the >>> filename >>> here, but what I want to do is to get the first 11 records and print >>> out >>> a new line "\n", then get the next 11 record and get new line "\n" >>> >>> I get the data from mediotiempo.com, >>> >>> data: >>> >>> Pos. EquipoJJ JG JE JP GF GC >>> DIFPTS 1 Monterrey 17 12 1 4 38 >>> 23 15 37 2 Pachuca 17 8 6 3 >>> 31 16 15 30 3 León17 9 3 5 >>> 29 19 10 30 4 América 17 8 5 >>> 4 34 22 12 29 5 Chivas 17 7 7 >>> 3 26 16 10 28 6Morelia 17 8 >>> 4 5 25 24 1 28 7Santos 17 8 >>> 3 6 22 20 2 27 8Tigres 17 >>> 6 6 5 29 19 10 24 9Cruz Azul >>> 17 5 7 5 25 24 1 22 10 Pumas >>> 17 57 5 23 24 -1 22 11 Toluca >>> 17 57 5 20 21 -1 22 12 Puebla >>> 17 57 5 21 26 -5 22 13 Club >>> Querétaro 17 5 4 8 21 26 -5 >>> 19 14 Club Tijuana 17 3 9 5 17 26 >>> -9 18 15 Atlas 17 35 9 18 26 >>> -8 14 16 Dorados 17 42 11 18 >>> 32 -14 14 17 Veracruz17 28 7 >>> 18 34 -16 14 18 Chiapas FC 17 33 >>> 11 16 33 -17 12 >>> >>> to >>> >>> Pos Equipo JJ JG JE JP GF GC DIF PTS >>> 1 Monterrey 16 12 1 3 37 21 16 37 >>> 2 America 16 8 4 4 33 21 12 28 >>> 3 Pachuca 16 7 6 3 29 15 14 27 >>> 4 Leon16 8 3 5 28 19 9 27 >>> 5 Santos 16 8 3 5 22 19 3 27 >>> 6 Chivas 16 6 7 3 25 16 9 25 >>> 7 Morelia 16 7 4 5 23 23 0 25 >>> 8 CruzAzul16 5 7 4 25 21 4 22 >>> 9 Tigres 16 5 6 5 26 19 7 21 >>> 10 Pumas 16 5 6 5 22 23 -1 21 >>> 11 Toluca 16 4 7 5 18 20 -2 19 >>> 12 ClubQueretaro 16 5 4 7 20 23 -3 19 >>> 13 Puebla 16 4 7 5 18 25 -7 19 >>> 14 ClubTijuana 16 3 8 5 17 26 -9 17 >>> 15 Dorados 16 4 2 10 18 31 -13 14 >>> 16 Veracruz16 2 8 6 17 32 -15 14 >>> 17 Atlas 16 3 4 9 18 26 -8 13 >>> 18 ChiapasFC 16 3 3 10 15 31 -16 12 >>> >>> using a sed command. >>> >>> I have parts of commands as follows: >>> >>> #!/bin/sh >>> >>> # Check for arguments >>> if [ $# -eq 0 ]; then >>> echo "Usage: $(basename $0) filename" >>> exit 1 >>> fi >>> >>> if [ ! -f $1 ]; then >>> echo "File "$1" doesn't exist!" >>> exit 0 >>> fi >>> >>> awk ' >>> >>> NR == 1 { >>> printf "%2s %-14s %3s %3s %3s %3s %3s %3s %3s %3s \n", >>> "Pos", "Equipo", "JJ", "JG", "JE", "JP", "GF", "GC" , >>> "DIF", "PTS" >>> } >>> >&
Re: using awk for selective printing, and adding a new line
> -Original Message- > From: ad+li...@uni-x.org > Sent: Mon, 9 May 2016 20:47:49 +0200 > To: users@lists.fedoraproject.org > Subject: Re: using awk for selective printing, and adding a new line > > Am 09.05.2016 um 18:24 schrieb Antonio Olivares: >> Dear folks, >> >> I have found numerous guides using awk to format stats. I can get stats >> from a website, but when I paste them they get pasted one per line, I >> can get them to one line using awk '{printf("%s ",$0)}' and the filename >> here, but what I want to do is to get the first 11 records and print out >> a new line "\n", then get the next 11 record and get new line "\n" >> >> I get the data from mediotiempo.com, >> >> data: >> >> Pos. EquipoJJ JG JE JP GF GC >> DIFPTS 1 Monterrey 17 12 1 4 38 >> 23 15 37 2 Pachuca 17 8 6 3 >> 31 16 15 30 3 León17 9 3 5 >> 29 19 10 30 4 América 17 8 5 >> 4 34 22 12 29 5 Chivas 17 7 7 >> 3 26 16 10 28 6Morelia 17 8 >> 4 5 25 24 1 28 7Santos 17 8 >> 3 6 22 20 2 27 8Tigres 17 >> 6 6 5 29 19 10 24 9Cruz Azul >> 17 5 7 5 25 24 1 22 10 Pumas >> 17 57 5 23 24 -1 22 11 Toluca >> 17 57 5 20 21 -1 22 12 Puebla >> 17 57 5 21 26 -5 22 13 Club >> Querétaro 17 5 4 8 21 26 -5 >> 19 14 Club Tijuana 17 3 9 5 17 26 >> -9 18 15 Atlas 17 35 9 18 26 >> -8 14 16 Dorados 17 42 11 18 >> 32 -14 14 17 Veracruz17 28 7 >> 18 34 -16 14 18 Chiapas FC 17 33 >> 11 16 33 -17 12 >> >> to >> >> Pos Equipo JJ JG JE JP GF GC DIF PTS >> 1 Monterrey 16 12 1 3 37 21 16 37 >> 2 America 16 8 4 4 33 21 12 28 >> 3 Pachuca 16 7 6 3 29 15 14 27 >> 4 Leon16 8 3 5 28 19 9 27 >> 5 Santos 16 8 3 5 22 19 3 27 >> 6 Chivas 16 6 7 3 25 16 9 25 >> 7 Morelia 16 7 4 5 23 23 0 25 >> 8 CruzAzul16 5 7 4 25 21 4 22 >> 9 Tigres 16 5 6 5 26 19 7 21 >> 10 Pumas 16 5 6 5 22 23 -1 21 >> 11 Toluca 16 4 7 5 18 20 -2 19 >> 12 ClubQueretaro 16 5 4 7 20 23 -3 19 >> 13 Puebla 16 4 7 5 18 25 -7 19 >> 14 ClubTijuana 16 3 8 5 17 26 -9 17 >> 15 Dorados 16 4 2 10 18 31 -13 14 >> 16 Veracruz16 2 8 6 17 32 -15 14 >> 17 Atlas 16 3 4 9 18 26 -8 13 >> 18 ChiapasFC 16 3 3 10 15 31 -16 12 >> >> using a sed command. >> >> I have parts of commands as follows: >> >> #!/bin/sh >> >> # Check for arguments >> if [ $# -eq 0 ]; then >> echo "Usage: $(basename $0) filename" >> exit 1 >> fi >> >> if [ ! -f $1 ]; then >> echo "File "$1" doesn't exist!" >> exit 0 >> fi >> >> awk ' >> >> NR == 1 { >> printf "%2s %-14s %3s %3s %3s %3s %3s %3s %3s %3s \n", >> "Pos", "Equipo", "JJ", "JG", "JE", "JP", "GF", "GC" , >> "DIF", "PTS" >> } >> >> NR >= 2 { >> printf "%2d %-14s %3d %3d %3d %3d %3d %3d %3d %3d \n", >> $1, $2, $3, $4, $5, $6, $7, $8, $9, $10 '\n' >> }' $1 >> >> but it just prints the first line and that is it because it treats the >> data as a single line. If that is possible otherwise I will have to do >> it manually. >> >> Best regards, >> >> >> Antonio > > > If you manage that the club names are always single fields of a > reasonable length, then > > awk '{ for (i = 1; i <=
Re: using awk for selective printing, and adding a new line
Am 09.05.2016 um 18:24 schrieb Antonio Olivares: Dear folks, I have found numerous guides using awk to format stats. I can get stats from a website, but when I paste them they get pasted one per line, I can get them to one line using awk '{printf("%s ",$0)}' and the filename here, but what I want to do is to get the first 11 records and print out a new line "\n", then get the next 11 record and get new line "\n" I get the data from mediotiempo.com, data: Pos. EquipoJJ JG JE JP GF GC DIF PTS 1 Monterrey 17 12 1 4 38 23 15 37 2 Pachuca 17 8 6 3 31 16 15 30 3 León17 9 3 5 29 19 10 30 4 América 17 8 5 4 34 22 12 29 5 Chivas 17 7 7 3 26 16 10 28 6 Morelia 17 8 4 5 25 24 1 28 7 Santos 17 8 3 6 22 20 2 27 8Tigres 17 6 6 5 29 19 10 24 9Cruz Azul 17 5 7 5 25 24 1 22 10 Pumas 17 57 5 23 24 -1 22 11 Toluca 17 57 5 20 21 -1 22 12 Puebla 17 57 5 21 26 -5 22 13 Club Querétaro 17 5 4 8 21 26 -5 19 14 Club Tijuana 17 3 9 5 17 26 -9 18 15 Atlas 17 35 9 18 26 -8 14 16 Dorados 17 42 11 18 32 -14 14 17 Veracruz17 28 7 18 34 -16 14 18 Chiapas FC 17 33 11 16 33 -17 12 to Pos Equipo JJ JG JE JP GF GC DIF PTS 1 Monterrey 16 12 1 3 37 21 16 37 2 America 16 8 4 4 33 21 12 28 3 Pachuca 16 7 6 3 29 15 14 27 4 Leon16 8 3 5 28 19 9 27 5 Santos 16 8 3 5 22 19 3 27 6 Chivas 16 6 7 3 25 16 9 25 7 Morelia 16 7 4 5 23 23 0 25 8 CruzAzul16 5 7 4 25 21 4 22 9 Tigres 16 5 6 5 26 19 7 21 10 Pumas 16 5 6 5 22 23 -1 21 11 Toluca 16 4 7 5 18 20 -2 19 12 ClubQueretaro 16 5 4 7 20 23 -3 19 13 Puebla 16 4 7 5 18 25 -7 19 14 ClubTijuana 16 3 8 5 17 26 -9 17 15 Dorados 16 4 2 10 18 31 -13 14 16 Veracruz16 2 8 6 17 32 -15 14 17 Atlas 16 3 4 9 18 26 -8 13 18 ChiapasFC 16 3 3 10 15 31 -16 12 using a sed command. I have parts of commands as follows: #!/bin/sh # Check for arguments if [ $# -eq 0 ]; then echo "Usage: $(basename $0) filename" exit 1 fi if [ ! -f $1 ]; then echo "File "$1" doesn't exist!" exit 0 fi awk ' NR == 1 { printf "%2s %-14s %3s %3s %3s %3s %3s %3s %3s %3s \n", "Pos", "Equipo", "JJ", "JG", "JE", "JP", "GF", "GC" , "DIF", "PTS" } NR >= 2 { printf "%2d %-14s %3d %3d %3d %3d %3d %3d %3d %3d \n", $1, $2, $3, $4, $5, $6, $7, $8, $9, $10 '\n' }' $1 but it just prints the first line and that is it because it treats the data as a single line. If that is possible otherwise I will have to do it manually. Best regards, Antonio If you manage that the club names are always single fields of a reasonable length, then awk '{ for (i = 1; i <= NF; i++) if (i % 10) printf "%s\t", $i; else printf "%s\n", $i }' $yourinputfile does what you want. Alexander -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: http://lists.fedoraproject.org/admin/lists/users@lists.fedoraproject.org Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
using awk for selective printing, and adding a new line
Dear folks, I have found numerous guides using awk to format stats. I can get stats from a website, but when I paste them they get pasted one per line, I can get them to one line using awk '{printf("%s ",$0)}' and the filename here, but what I want to do is to get the first 11 records and print out a new line "\n", then get the next 11 record and get new line "\n" I get the data from mediotiempo.com, data: Pos. EquipoJJ JG JE JP GF GC DIF PTS 1 Monterrey 17 12 1 4 38 23 15 37 2 Pachuca 17 8 6 3 31 16 15 30 3 León17 9 3 5 29 19 10 30 4 América 17 8 5 4 34 22 12 29 5 Chivas 17 7 7 3 26 16 10 28 6 Morelia 17 8 4 5 25 24 1 28 7 Santos 17 8 3 6 22 20 2 27 8Tigres 17 6 6 5 29 19 10 24 9Cruz Azul 17 5 7 5 25 24 1 22 10 Pumas 17 57 5 23 24 -1 22 11 Toluca 17 57 5 20 21 -1 22 12 Puebla 17 57 5 21 26 -5 22 13 Club Querétaro 17 5 4 8 21 26 -5 19 14 Club Tijuana 17 3 9 5 17 26 -9 18 15 Atlas 17 35 9 18 26 -8 14 16 Dorados 17 42 11 18 32 -14 14 17 Veracruz17 28 7 18 34 -16 14 18 Chiapas FC 17 33 11 16 33 -17 12 to Pos Equipo JJ JG JE JP GF GC DIF PTS 1 Monterrey 16 12 1 3 37 21 16 37 2 America 16 8 4 4 33 21 12 28 3 Pachuca 16 7 6 3 29 15 14 27 4 Leon16 8 3 5 28 19 9 27 5 Santos 16 8 3 5 22 19 3 27 6 Chivas 16 6 7 3 25 16 9 25 7 Morelia 16 7 4 5 23 23 0 25 8 CruzAzul16 5 7 4 25 21 4 22 9 Tigres 16 5 6 5 26 19 7 21 10 Pumas 16 5 6 5 22 23 -1 21 11 Toluca 16 4 7 5 18 20 -2 19 12 ClubQueretaro 16 5 4 7 20 23 -3 19 13 Puebla 16 4 7 5 18 25 -7 19 14 ClubTijuana 16 3 8 5 17 26 -9 17 15 Dorados 16 4 2 10 18 31 -13 14 16 Veracruz16 2 8 6 17 32 -15 14 17 Atlas 16 3 4 9 18 26 -8 13 18 ChiapasFC 16 3 3 10 15 31 -16 12 using a sed command. I have parts of commands as follows: #!/bin/sh # Check for arguments if [ $# -eq 0 ]; then echo "Usage: $(basename $0) filename" exit 1 fi if [ ! -f $1 ]; then echo "File "$1" doesn't exist!" exit 0 fi awk ' NR == 1 { printf "%2s %-14s %3s %3s %3s %3s %3s %3s %3s %3s \n", "Pos", "Equipo", "JJ", "JG", "JE", "JP", "GF", "GC" , "DIF", "PTS" } NR >= 2 { printf "%2d %-14s %3d %3d %3d %3d %3d %3d %3d %3d \n", $1, $2, $3, $4, $5, $6, $7, $8, $9, $10 '\n' }' $1 but it just prints the first line and that is it because it treats the data as a single line. If that is possible otherwise I will have to do it manually. Best regards, Antonio FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more! -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: http://lists.fedoraproject.org/admin/lists/users@lists.fedoraproject.org Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org