Re: Shortening a script, but aiming for efficiency

2004-10-01 Thread John W. Krahn
Jose Alves de Castro wrote: To make it short: I have a small filter that I'd like to keep as compact as possible, while not losing efficiency. How it works: 1) ignore the first line (it's a header line) 2) if a line ends in a tab, remove that character 3) replace all tabs with pipes 4) if the

RE: Shortening a script, but aiming for efficiency

2004-10-01 Thread Allen, Greg
Warning: no fun :( next doesn't skip the continue block where the print is done. Instead you could: perl -pe $_= if $. 2; You have materially changed the substitution before: | - yours: | - the effect of 4) is to mean that \t\t - | and \tA - \tA. No idea why this is being done. Greg

Re: Shortening a script, but aiming for efficiency

2004-10-01 Thread Jose Alves de Castro
On Fri, 2004-10-01 at 05:12, John W. Krahn wrote: Jose Alves de Castro wrote: To make it short: I have a small filter that I'd like to keep as compact as possible, while not losing efficiency. How it works: 1) ignore the first line (it's a header line) 2) if a line ends in a tab,

Re: Shortening a script, but aiming for efficiency

2004-10-01 Thread Alan Young
a\tb\t a\t\t \tb\t \t\t\t The output for all these should be: a|b a|\s |b |\s This means that I could start by replacing all tabs with pipes, but then I would always have to remove the last pipe... I could replace two ending pipes with | (second and fourth cases), but I

Re: Shortening a script, but aiming for efficiency

2004-10-01 Thread Ronald J Kimball
On Fri, Oct 01, 2004 at 09:23:14AM -0600, Alan Young wrote: a\tb\t a\t\t \tb\t \t\t\t The output for all these should be: a|b a|\s |b |\s This means that I could start by replacing all tabs with pipes, but then I would always have to remove the last pipe... I