Prev: Data cleaning issue involving bad wide characters in what ought to be ascii data
Next: SIGUSR1 ignored during poll() if sleep() and warn() called?
From: Tad J McClellan on 9 Sep 2009 22:47 sln(a)netherlands.com <sln(a)netherlands.com> wrote: > Doh, what was I thinking. > /^(\s*)"*(.*?)"*(\s*)$/ Errr, that matches *every* string... -- Tad McClellan email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
From: sln on 9 Sep 2009 23:55 On Wed, 09 Sep 2009 21:47:52 -0500, Tad J McClellan <tadmc(a)seesig.invalid> wrote: >sln(a)netherlands.com <sln(a)netherlands.com> wrote: > >> Doh, what was I thinking. >> /^(\s*)"*(.*?)"*(\s*)$/ > > >Errr, that matches *every* string... Go figure, thats what I want... my $newstring = join "<tab>", map {/^(\s*|)"*(.*?|)"*(\s*|)$/; $1.'"'.$2.'"'.$3 } split (/\t/,$str); -sln
From: sln on 10 Sep 2009 00:17 On Wed, 09 Sep 2009 20:55:26 -0700, sln(a)netherlands.com wrote: >On Wed, 09 Sep 2009 21:47:52 -0500, Tad J McClellan <tadmc(a)seesig.invalid> wrote: > >>sln(a)netherlands.com <sln(a)netherlands.com> wrote: >> >>> Doh, what was I thinking. >>> /^(\s*)"*(.*?)"*(\s*)$/ >> >> >>Errr, that matches *every* string... > >Go figure, thats what I want... > >my $newstring = join "<tab>", map {/^(\s*|)"*(.*?|)"*(\s*|)$/; $1.'"'.$2.'"'.$3 } split (/\t/,$str); /^(\s*)"*(.*?)"*(\s*)$/ Its not perfect, but it's a start for somebody. -sln
From: toralf on 14 Sep 2009 11:00
toralf wrote: > I've a file containing tab separated values - most, but not all are > quoted - and now I'm wondering how to substitute a non-quoted value like > <tab>20090807<tab> by sth. like <tab>"20090807"<tab> Thx all - this works for me : $s =~ s/\t\d{8}\t/\t"$&"\t/; -- MfG/Sincerely Toralf F�rster pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3 |