Re: Help Parsing a Tab delimited file

2011-07-14 Thread C.DeRykus
On Jul 13, 11:17 pm, jwkr...@shaw.ca ("John W. Krahn") wrote: > C.DeRykus wrote: > >... > > That won't work as the shell will interpolate away the backslash: Not necessarily... it works on Win32's idea of a "shell" for instance :) But it doesn't hurt even there and is a good habit. > > $ echo

Re: Help Parsing a Tab delimited file

2011-07-14 Thread Dr.Ruud
On 2011-07-14 08:17, John W. Krahn wrote: You have to quote it: $ echo "one two three four" | perl -F'\t' -lane'print "$_: $F[$_]" for 0 .. $#F' 0: one 1: two 2: three 3: four Or double it: echo -e "a\tb\tc\td" |perl -F\\t -lane'print"$_: $F[$_]"for 0..$#F' 0: a 1: b 2: c 3: d -- Ruud --

Re: Help Parsing a Tab delimited file

2011-07-13 Thread John W. Krahn
C.DeRykus wrote: Basically, the one-liner reads the tab-delimited file line by line (-n); autosplits fields the line into fields based on whitespace (- a) and populates @F with those fields. If the 2nd column $F[1] , hasn't been seen or differs with the previous line's 2nd col., then a new out

Re: Help Parsing a Tab delimited file

2011-07-13 Thread C.DeRykus
On Jul 13, 5:42 pm, tiago.h...@gmail.com (Tiago Hori) wrote: > ... > > C.DeRykus wrote: > > There's already been a very good recommendation. But, if > > you know your file has no irregularities, is surprise-free as > > far as formatting,  you may be tempted to just try a 1-liner > > since Perl doe

Re: Help Parsing a Tab delimited file

2011-07-13 Thread Jim Gibson
On 7/13/11 Wed Jul 13, 2011 5:42 PM, "Tiago Hori" scribbled: > Hi Charles, > > Thanks a LOT. > > I am trying to learn the CSV mode for the future, but this software will > always spit the same file format at me, so your solution may be the way to go > for now. Would you mi d giving me a quick

Re: Help Parsing a Tab delimited file

2011-07-13 Thread Tiago Hori
Hi Charles, Thanks a LOT. I am trying to learn the CSV mode for the future, but this software will always spit the same file format at me, so your solution may be the way to go for now. Would you mi d giving me a quick explanation on what that one liner does? It be useful for me to learn it in

Re: Help Parsing a Tab delimited file

2011-07-13 Thread C.DeRykus
On Jul 13, 9:59 am, tiago.h...@gmail.com (Tiago Hori) wrote: > Hi All, > > I work with microarrays and get huge tab delimited files as outputs from the > software that analysis these microarrays. The result is a tab-delimted Excel > type of file that has 16 rows and about 20 columns. > > Every

Re: Help Parsing a Tab delimited file

2011-07-13 Thread Shlomi Fish
On Wed, 13 Jul 2011 11:15:55 -0700 Leo Susanto wrote: > On Wed, Jul 13, 2011 at 11:06 AM, Shlomi Fish wrote: > > Hi Tiago, > > > > > > You can write the data directly to the four filehandles as you go over them. > > You can have filehandles as the values of arrays or hashes. > > > > Just make su

Re: Help Parsing a Tab delimited file

2011-07-13 Thread Shlomi Fish
Hi Tiago, You sent this message to me in private, so I'm CCing the list. Next time please hit "Reply to all" instead of "Reply" (see my signature for more information.) On Wed, 13 Jul 2011 15:51:00 -0230 Tiago Hori wrote: > Hi Shlomi, > > Thanks a LOT! > You're welcome. > This may be a sill

Re: Help Parsing a Tab delimited file

2011-07-13 Thread Leo Susanto
On Wed, Jul 13, 2011 at 11:06 AM, Shlomi Fish wrote: > Hi Tiago, > > > You can write the data directly to the four filehandles as you go over them. > You can have filehandles as the values of arrays or hashes. > > Just make sure you are using a CSV parsing and output module: > > http://beta.metacp

Re: Help Parsing a Tab delimited file

2011-07-13 Thread Shlomi Fish
Hi Tiago, On Wed, 13 Jul 2011 14:29:40 -0230 Tiago Hori wrote: > Hi All, > > I work with microarrays and get huge tab delimited files as outputs from the > software that analysis these microarrays. The result is a tab-delimted Excel > type of file that has 16 rows and about 20 columns. > >

Help Parsing a Tab delimited file

2011-07-13 Thread Tiago Hori
Hi All, I work with microarrays and get huge tab delimited files as outputs from the software that analysis these microarrays. The result is a tab-delimted Excel type of file that has 16 rows and about 20 columns. Every 44K rows make one unit within the data. These units are identified by the