in reply to break up file with no line breaks
(The particular use of quotes there assumes a bash or similar Bourne-like shell.)perl -ne 'BEGIN{$/=","} $o.=$_; if(length($o)>=80){ print "$o\n";$o="" + } END{print "$o\n"}' < file.no-breaks > file.with-breaks
Then again, when the purpose of a data file is simply to store list, I personally don't see the point of using commas at all. It's much better to use line-breaks as delimiters between list elements, because then you can use lots of handy unix tools to good effect in order to do things like (de)select, count, sort or otherwise process the elements. And going from comma-delimited (with no line-breaks) to line-break delimited is really simple:
perl -pe 'tr/,/\n/' < comma.delimited > newline.delimited
|
|---|