Shell script to force carriage return to avoid long lines
I hav开发者_StackOverflowe to use a tool (namely, Rez) which processes text but does not allow long text lines; I would like to shorten long lines with a pre-formatting script.
The script I'm looking for is a simple (darwin/unix) shell script which cuts long lines, for instance inserting a carriage return after the 70th character of the line, if the character is a space (any other idea would work, I thing).
Any idea how to do that?
Thanks
the fold
utility does the job, with the -s option. Do not forget to set the correct locale setting so that fold does not fail on special characters.
All my thanks to mvds.
精彩评论