🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #7701

Re: "Transponer" u fichero de texto.

#7701
From: catactttc
Date: Fri, 07 Feb 2003 18:13
49 lines
1954 bytes
In article <873cn0hz9a.fsf@ietcc.csic.es>, Han Solo wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hola a todos.
> 
> Lo primero el problema:
> 
> tengo un fichero de texto, supongamos algo como:
> 
> a1 a2 a3 a4 a5
> b1 b2 b3 b4 b5
> c1 c2 c3 c4 c5
> d1 d2 d3 d4 d5
> e1 e2 e3 e4 e5
> 
> y quiero convertirlo en su "transpuesto";
> 
> a1 b1 c1 d1 e1
> a2 b2 c2 d2 e2
> a3 b3 c3 d3 e3
> a4 b4 c4 d4 e4
> a5 b5 c5 d5 e5
> 
> 


#! /usr/bin/awk -f
{
  split($0, a);
  for (i = 1; i <= NF; i++) {
    b[i] = b[i] " " a[i];   
  }
}
END { 
  for (i = 1; i <= NF; i++) {
    print b[i]               
  }   
}  

No es m�o, ayer lo poste� alguien en comp.unix.shell. Hace exactamente
lo que pides.

Un saludo.

-- 
Grupo de usuarios de Mandrake:   |   i386-slackware-linux-gnu (2.4.20)
<http://www.mandrakeusers.org>   |   bash: 2.05a.0(1)-release
aru                              |   <catactttc@nospammail.net>
Technical Details
Message-ID: <b20t0c$1tb$1@peque.uv.es>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.rediris.es!news.uv.es!not-for-mail
References: <873cn0hz9a.fsf@ietcc.csic.es>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,197d58af93fd12d4
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2003-02-07 10:18:02 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.rediris.es!news.uv.es!not-for-mail
From: catactttc <catactttc@nospammail.net>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: "Transponer" u fichero de texto.
Date: Fri, 7 Feb 2003 18:13:32 +0000 (UTC)
Organization: Universitat de Valencia
Lines: 49
Distribution: es
Message-ID: <b20t0c$1tb$1@peque.uv.es>
References: <873cn0hz9a.fsf@ietcc.csic.es>
NNTP-Posting-Host: 193-153-149-164.uc.nombres.ttd.es
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: peque.uv.es 1044641612 1963 193.153.149.164 (7 Feb 2003 18:13:32 GMT)
X-Complaints-To: newsmanager@uv.es
NNTP-Posting-Date: Fri, 7 Feb 2003 18:13:32 +0000 (UTC)
User-Agent: slrn/0.9.7.4 (Linux)