`set' in der shell: Bug?
Jan-Benedict Glaw
jbglaw at lug-owl.de
Wed Jun 2 13:57:00 CEST 2010
On Wed, 2010-06-02 13:19:50 +0200, Jan 'RedBully' Seiffert <redbully at cc.hs-owl.de> wrote:
> Jan-Benedict Glaw schrieb:
> > On Tue, 2010-06-01 22:16:14 +0100, A. Dreyer (LUG-OWL) <ml10227 at adreyer.com> wrote:
> > > On 01/06/10 13:19, Jan-Benedict Glaw wrote:
> > > > Mit dem IFS hatte ich schon gespielt; das machts aber nicht unbedingt
> > > > einfacher, weil dann z.B. kein Komma mehr in einem der C-Strings
> > > > auftauchen darf. Ebenso würden Geschichten wie
> > > >
> > > > foo ("This is a text with a real (\") quotation mark", 5.3);
> > > >
> > > > nicht mehr ordentlich geparst werden.
> > >
> > > Ich denke für eine derartige Aufgabe ist die Shell eigentlich das
> > > falsche Tool und ich würde hier auf Perl und zB. Text::CSV zurück greifen..
> >
> > Wie siehts da mit dem Escape-Handling aus? (/me hat keine Ahnung von
> > Perl.)
>
> awk?
>
> $ echo '"This is a text with a real (\") quotation mark", 5.3' | awk -F ,
> '{printf "%s\n%s\n", $1, $2}'
> "This is a text with a real (\") quotation mark"
> 5.3
Das hätte ein IFS=',' read x y z auch lösen können :) Hier ist der
Haken dann, daß kein Komma im String enthalten sein darf.
MfG, JBG
--
Jan-Benedict Glaw jbglaw at lug-owl.de +49-172-7608481
Signature of: http://perl.plover.com/Questions.html
the second :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lug-owl.de/pipermail/linux/attachments/20100602/2abbc931/attachment.sig>
More information about the Linux
mailing list