Hi I would like to wrap the following comma separated data:
-X, run, abs, absolute, accept, accept, alarm, schedule, atan2, arctangent, bind, binds, binmode, prepare, bless, create, caller, get, chdir, change, chmod, changes, chomp, remove, chop, remove, chown, change, chr, get, chroot, make, close, close, closedir, close, connect, connect, continue, optional, cos, cosine, crypt, one-way, dbmclose, breaks, dbmopen, create, defined, test, delete, deletes, die, raise, do, turn, dump, create, each, retrieve, endgrent, be, endhostent, be, endnetent, be, endprotoent, be, endpwent, be, endservent, be, eof, test, eval, catch, exec, abandon, exists, test, exit, terminate, exp, raise, fcntl, file, fileno, return, flock, lock, fork, create, format, declare, formline, internal, getc, get, getgrent, get, getgrgid, get, getgrnam, get, gethostbyaddr, get, gethostbyname, get, gethostent, get, getlogin, return, getnetbyaddr, get, getnetbyname, get, getnetent, get, getpeername, find, getpgrp, get, getppid, get, getpriority, get, getprotobyname, get, getprotobynumber, get, getprotoent, get, getpwent, get, getpwnam, get, getpwuid, get, getservbyname, get, getservbyport, get, getservent, get, getsockname, retrieve, getsockopt, get, glob, expand, gmtime, convert, goto, create, grep, locate, hex, convert, import, patch, int, get, ioctl, system-dependent, join, join, keys, retrieve, kill, send, last, exit, lc, return, lcfirst, return, length, return, link, create, listen, register, local, create, localtime, convert, log, retrieve, lstat, stat, m//, match, map, apply, mkdir, create, msgctl, SysV, msgget, get, msgrcv, receive, msgsnd, send, my, declare, next, iterate, no, unimport, oct, convert, open, open, opendir, open, ord, find, pack, convert, package, declare, pipe, open, pop, remove, pos, find, print, output, printf, output, prototype, get, push, append, q/STRING/, singly, qq/STRING/, doubly, quotemeta, quote, qw/STRING/, quote, qx/STRING/, backquote, rand, retrieve, read, fixed-length, readdir, get, readlink, determine, recv, receive, redo, start, ref, find, rename, change, require, load, reset, clear, return, get, reverse, flip, rewinddir, reset, rindex, right-to-left, rmdir, remove, s///, replace, scalar, force, seek, reposition, seekdir, reposition, select, reset, semctl, SysV, semget, get, semop, SysV, send, send, setgrent, prepare, sethostent, prepare, setnetent, prepare, setpgrp, set, setpriority, set, setprotoent, prepare, setpwent, prepare, setservent, prepare, setsockopt, set, shift, remove, shmctl, SysV, shmget, get, shmread, read, shmwrite, write, shutdown, close, sin, return, sleep, block, socket, create, socketpair, create, sort, sort, splice, add, split, split, sprintf, formatted, sqrt, square, srand, seed, stat, get, study, optimize, sub, declare, substr, get, symlink, create, syscall, execute, sysread, fixed-length, system, run, syswrite, fixed-length, tell, get, telldir, get, tie, bind, time, return, times, return, tr///, transliterate, truncate, shorten, uc, return, ucfirst, return, umask, set, undef, remove, unlink, remove, unpack, convert, unshift, prepend, untie, break, use, load, utime, set, values, return, vec, test, wait, wait, waitpid, wait, wantarray, get, warn, print, write, print, y///, transliterate,
such that a line break is added at the last comma before a 70 character line length. Preferable this could be done in some kind of bash one liner.
That should give you the output you want. Instead of using echo you can pipe it from a file or wherever else you’re getting it from, or you can just use the fold command directly and paste it in on stdin.
The “-w 70” in fold tells it to wrap after 70 characters per line, and the -s tells it to wrap on the spaces after each comma.