The command
tail -n +2 mascal.txt | sed 'N;N;N;N;N;N;N;N;N;s/\n/\t/g;' | head -n -2
would output the following:
Code: Select all
simbolo Pcio. Ultimo Variac. hora Cierre Ant. Pcio. Max. Pcio. Min. V. Nominal Mto. Negoc. Op.
ALUA 62,40 3,83% 17:00:02 60,10 62,70 59,20 952.604,00 57.674.155,00 1.042,00
BBAR 231,95 -0,26% 17:00:02 232,55 236,95 229,80 66.601,00 15.541.213,00 299,00
BMA 319,05 -1,01% 17:00:02 322,30 326,00 317,00 91.589,00 29.419.245,00 320,00
BYMA 815,50 0,87% 17:00:02 808,50 819,50 802,00 54.498,00 44.207.504,00 216,00
CEPU 61,65 0,82% 17:00:02 61,15 63,55 60,00 2.415.464,00 150.780.450,00 1.374,00
COME 4,99 1,63% 17:00:02 4,91 5,03 4,83 3.134.163,00 15.487.357,00 683,00
CRES 97,40 2,53% 17:00:02 95,00 97,95 95,05 252.557,00 24.520.849,00 647,00
CVH 378,50 -1,69% 17:00:02 385,00 389,50 367,00 81.992,00 30.640.065,00 377,00
EDN 60,45 -3,20% 17:00:02 62,45 62,75 60,10 555.790,00 33.596.852,00 280,00
GGAL 183,70 -0,54% 17:00:02 184,70 186,70 183,50 1.124.001,00 208.010.164,00 1.340,00
HARG 152,50 -4,39% 17:00:02 159,50 164,25 151,00 267.804,00 41.833.451,00 814,00
LOMA 268,10 0,07% 17:00:02 267,90 271,55 264,00 182.131,00 48.752.230,00 438,00
MIRG 3.253,00 1,59% 17:00:02 3.202,00 3.276,50 3.180,00 18.561,00 59.304.631,00 426,00
PAMP 127,90 -0,74% 17:00:02 128,85 130,50 126,75 264.924,00 34.074.400,00 513,00
RICH 236,50 -1,87% 17:00:02 241,00 240,50 231,00 11.418,00 2.705.584,00 100,00
SUPV 84,55 -0,18% 17:00:02 84,70 86,45 83,50 206.141,00 17.600.632,00 348,00
TECO2 187,70 0,75% 17:00:02 186,30 190,00 185,05 65.584,00 12.239.587,00 836,00
TGNO4 84,20 0,00% 17:00:02 84,20 88,00 82,00 377.556,00 31.957.608,00 599,00
TGSU2 182,45 -2,12% 17:00:02 186,40 188,20 181,00 150.428,00 27.704.612,00 572,00
TRAN 49,30 0,51% 17:00:02 49,05 50,40 48,10 524.973,00 26.090.953,00 468,00
TXAR 90,60 -0,11% 17:00:02 90,70 92,90 88,80 1.305.882,00 117.819.481,00 1.262,00
VALO 24,40 2,95% 17:00:02 23,70 24,60 23,55 604.598,00 14.525.093,00 525,00
YPFD 865,05 -0,56% 17:00:02 869,95 888,55 860,00 102.615,00 89.457.198,00 903,00
Is that what you want?
The tail command strips of the first line (it says to print mascal.txt from the 2nd line), which has the date. sed normally works at one line at a time but the 9 N sed commands read 9 more lines into the sed buffer, for total of 10 lines. Then the s/\n/\t/g command substitutes all newlines with tabs so makes it one line. After all that two lines at the end of the output are left (the "Fuente: Información propiedad de BCBA diferida en 30 minutos. Para más información consultar
www.bolsar.com" line and an empty line) which the head command strips off (it says to print all lines except for the last 2).
For a bit nicer output on the terminal, with right aligned data and cells in each column having equal width, use this command:
tail -n +2 mascal.txt | sed 'N;N;N;N;N;N;N;N;N;s/\n/\t/g;' | head -n -2 | column -s$'\t' -t -R 2,3,4,5,6,7,8,9,10
That would output:
Code: Select all
simbolo Pcio. Ultimo Variac. hora Cierre Ant. Pcio. Max. Pcio. Min. V. Nominal Mto. Negoc. Op.
ALUA 62,40 3,83% 17:00:02 60,10 62,70 59,20 952.604,00 57.674.155,00 1.042,00
BBAR 231,95 -0,26% 17:00:02 232,55 236,95 229,80 66.601,00 15.541.213,00 299,00
BMA 319,05 -1,01% 17:00:02 322,30 326,00 317,00 91.589,00 29.419.245,00 320,00
BYMA 815,50 0,87% 17:00:02 808,50 819,50 802,00 54.498,00 44.207.504,00 216,00
CEPU 61,65 0,82% 17:00:02 61,15 63,55 60,00 2.415.464,00 150.780.450,00 1.374,00
COME 4,99 1,63% 17:00:02 4,91 5,03 4,83 3.134.163,00 15.487.357,00 683,00
CRES 97,40 2,53% 17:00:02 95,00 97,95 95,05 252.557,00 24.520.849,00 647,00
CVH 378,50 -1,69% 17:00:02 385,00 389,50 367,00 81.992,00 30.640.065,00 377,00
EDN 60,45 -3,20% 17:00:02 62,45 62,75 60,10 555.790,00 33.596.852,00 280,00
GGAL 183,70 -0,54% 17:00:02 184,70 186,70 183,50 1.124.001,00 208.010.164,00 1.340,00
HARG 152,50 -4,39% 17:00:02 159,50 164,25 151,00 267.804,00 41.833.451,00 814,00
LOMA 268,10 0,07% 17:00:02 267,90 271,55 264,00 182.131,00 48.752.230,00 438,00
MIRG 3.253,00 1,59% 17:00:02 3.202,00 3.276,50 3.180,00 18.561,00 59.304.631,00 426,00
PAMP 127,90 -0,74% 17:00:02 128,85 130,50 126,75 264.924,00 34.074.400,00 513,00
RICH 236,50 -1,87% 17:00:02 241,00 240,50 231,00 11.418,00 2.705.584,00 100,00
SUPV 84,55 -0,18% 17:00:02 84,70 86,45 83,50 206.141,00 17.600.632,00 348,00
TECO2 187,70 0,75% 17:00:02 186,30 190,00 185,05 65.584,00 12.239.587,00 836,00
TGNO4 84,20 0,00% 17:00:02 84,20 88,00 82,00 377.556,00 31.957.608,00 599,00
TGSU2 182,45 -2,12% 17:00:02 186,40 188,20 181,00 150.428,00 27.704.612,00 572,00
TRAN 49,30 0,51% 17:00:02 49,05 50,40 48,10 524.973,00 26.090.953,00 468,00
TXAR 90,60 -0,11% 17:00:02 90,70 92,90 88,80 1.305.882,00 117.819.481,00 1.262,00
VALO 24,40 2,95% 17:00:02 23,70 24,60 23,55 604.598,00 14.525.093,00 525,00
YPFD 865,05 -0,56% 17:00:02 869,95 888,55 860,00 102.615,00 89.457.198,00 903,00
The first output can be useful for reading the data into some other program, values are tab separated. The second output useful for displaying on the terminal.
If intended for reading in a different program the output can also easily be transformed to JSON.