[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: matrix text editing
From: |
Bob Proulx |
Subject: |
Re: matrix text editing |
Date: |
Wed, 2 Apr 2003 01:10:05 -0700 |
User-agent: |
Mutt/1.3.28i |
Tsuyoshi Takada wrote:
>
> I wonder why it is regarded as homework when I question such a problem...
It just had that feel of the type of problem which is constructed as a
programming exercise given to students. It is very common for
students to try to use the net to get help for their assignments. I
have become more cautious.
> This is pure question. I have thinked for more than one week but I
> could not reached to the good idea.
Please accept my sincere apology.
> I have perl skill for a few years and it is very easy to realize
> this with perl script file, but I want to accomplish this on command
> line because I easily want to do it too on the machines except my
> machine. If every time I write a perl script file and copy it to
> the other machine, it costs much time.
I cannot personally think of any way to easily accomplish this with
the core set of utilities. But perhaps others on the list will take
it as a challenge to produce a way and to educate both of us.
However, a one line ruby script comes to mind.
ruby -e '$/="delimiter";ARGF.each { |line| puts line.chomp.split("
").join("\t") }'
This of course can be done similarly with perl.
perl -e '$/="delimiter";for (<>) { chomp; print join("\t",split(" ")),"\n";}'
And even those could almost certainly be simplified further.
Bob