I have a file which has only one huge line. I want to split it to multiple lines.
when I use
fold -w30 filename.
it can not split the file.
when using
fold -sw30 filename.
it works fine.
in man file, the -s break at spaces.
in previous posting, I got one script which using awk split file. it worked perfect for my old file. but it can not split this file.
Well, rows are in databases and spreadsheets, text just has characters, lines, maybe pages. If you muck with the data, it is not always appreciated by tools that like the original. Adding data, lf characters for folding, will be different than replacing data, longer file for starters.
You have a line too long = full file and null characters. You can look at it using 'od' or similar tools, even 'cat -vt' can be useful. Maybe the nulls should be line feeds?
If you turn all the spaces into line feeds using tr, you have a lot of small lines you can concatenate as you please using the line oriented tools.