0

I use

make | tee >(split -d -b 10000000 - debug.log.0)

to split the output into several debug files after reaching 10MB.

this results in files called debug.log.000, debug.log.001, debug.log.002 ...

I could rename them afterwards with

for i in debug*; do echo $i; done

But how can I reconstruct the command, so they get the ending .log at the end of each file directly?

1

You can choose the file-ending for the split files with the option --additional-suffix

make | tee >(split --additional-suffix=.log -d -b 10000000 - debug.0)
  • This is not posix – ctac_ Jun 12 at 16:42
0
find . -maxdepth 1 -size +10M -exec du -shk {} \;| sed "s/\.\///g"|awk '$1 > 50 {print "split -l Specifylinenumber"  " " $2}'|sh


After above file whose size is greater than 10M will be splitted as xaa,xab,xac and so on

Use below command to get it renamed

f=1;for i in xa*; do  mv $i debug.log.00$f; f=$(($f+1)); done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.