LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] joining columns/removing commas in a CSV file?

[ILUG] joining columns/removing commas in a CSV file?

kevin lyda kevin at suberic.net
Wed Nov 15 21:32:48 GMT 2000


On Wed, Nov 15, 2000 at 06:55:56PM +0000, fergal daly wrote:
> perl -pe '$i=1;s/,/$i++=~m#4|5|6#?"":","/ge' filename

wow.  a nested r.e., an implied loop.  surely a functional language
could do no better?  anyone know guile or ocaml?  and not only is it
truly gorgeous but...

> which is shorter and more perverse than anything I've seen so far, also,
> you can get it to eliminate different commas just by changing the 4|5|6

it's configurable!

do you teach perl - wasn't someone looking for perl classes?  here's
yer man!

kevin

-- 
kevin at suberic.net        q: what's the difference between batman & b. gates?
fork()'ed on 37058400    a: when batman fought the penguin, he won.
meatspace place: home                             http://suberic.net/~kevin/
 >> want privacy? www.gnupg.org or www.pgp.com.  encrypted mail preferred <<




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell