On 16 Jun 2009, at 09:15, Carlton wrote: > I don't suppose anyone has a filter for converting (say) CSV into an > ASCII table do they?
Nice to see some home-brewed solutions, and not all in Perl :)! Here's a short and simple script in newLISP: #!/usr/bin/env newlisp (set 'file (open ((main-args) 2) "read")) (set 'column-widths (dup 0 80)) (while (read-line file) (push (set 'line (parse (current-line) ",")) content -1) (unless (empty? line) (set 'column-widths (map max (map length line) column-widths)))) (set 'format-string (join (map (fn (s) (string "%-" (inc s) "s")) column-widths))) (map (fn (l) (unless (empty? l) (println (format format-string l)))) content) which turns this input: ---------------- Heading,Title,Value,Extremely Long Column,Notes 1,12312312,,1231241231231,12312 a,b,c,d,e f,g,c,, ,,,,this is a note ---------------- into this output: ---------------- Heading Title Value Extremely Long Column Notes 1 12312312 1231241231231 12312 a b c d e f g c this is a note ---------------- The great thing about BBEdit's Unix filters is that you can apply them to just the selected text... cheers --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a specific feature request or would like to report a suspected (or confirmed) problem with the software, please email to "supp...@barebones.com" rather than posting to the group. -~----------~----~----~----~------~----~------~--~---