9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: quanstro@quanstro.net
To: 9fans@cse.psu.edu
Subject: Re: [9fans] csv files -> embarrasing
Date: Fri, 28 Apr 2006 09:43:19 -0500	[thread overview]
Message-ID: <5aed20f12bb9ba5ff42a3445a65eeb24@quanstro.net> (raw)
In-Reply-To: <c22c600f644b0141b2bf9b93b912407e@quintile.net>

i had this problem years ago processing original yahoo categories.
i think the solution is to use regexps to do a "lifting". first
translate the commas within "..." to, say, "☺".  then do your csv
operation and finally translate the "☺" back to ",".

this is totally untested, but something like this:

# should be f* and f*' 

fn fstar {
	{
	 	echo 'X ,x:"[^"]*": s:,:☺:g'
	  	 echo ,p
	} | sam -d $*
}

fn fstartick {
	{
	 	echo 'X ,x:"[^"]*": s:☺:,:g'
	  	 echo ,p
	} | sam -d $*
}

for(i in $files)
	fstar $i | extract | fstartick /fd/0

- erik


  reply	other threads:[~2006-04-28 14:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-28 14:36 Steve Simon
2006-04-28 14:43 ` quanstro [this message]
2006-04-28 16:29 ` Russ Cox
2006-04-28 18:28 ` lucio
2006-04-30 10:36   ` matt
2006-06-01 13:53 ` Victor Nazarov
2006-06-01 16:06   ` rog
2006-06-02  3:09 ` Rogelio Serrano
2006-05-01  0:34 erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5aed20f12bb9ba5ff42a3445a65eeb24@quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).