I'd like to print the first 255 characters followed by entire line separated with a '^' character.
(Right now I'm testing with 10 characters at a time instead of 255.) For example, this works fine with one huge problem:
cat myfile.txt | sed -e 's:^\(.\{10\}\)\(.*\)$:\1^\1\2:'
The problem is that some lines are very short, in which case I want to print the entire line twice separated with '^' character.
For example:
1234567890987654321
123
should print as:
1234567890^1234567890987654321
123^123
I don't really need to use sed, but it seems that sed should be able to do this - but any one line command would be nice.