This command splits text file by 30 characters. It also divide words but I need help for split text without divide the word find space between 30 and 40 after that split text file.
sed -e 's/.\{30\}/&\n/g' filename
Better use a proper lib, like in perl . The name for this is text wraping :
perl -MText::Wrap -lne '
$Text::Wrap::columns = 30;
print wrap("", "", $_)
' file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.