1

I need to reformat the output of a program created with cppUtest during my build from inside a makefile.

I have this target in my Makefile:

.PHONY: runalltests
runalltests: ##@tests Run all tests.
    $(ECHO)
    @./runAlltests

That executes the 'runalltests' program which outputs this text into terminal. (The dots are important)

......
OK (6 tests, 6 ran, 7 checks, 0 ignored, 0 filtered out, 0 ms)

I know from other answers in the stack overflow site that I need awk, sed or grep (or something I do not know of). But I can not figure it out for a long time now on how to do it so I gave up trying and ask here.

I want to reformat the output into adding 4 spaces before each line.

For example this:

 (Four spaces here)......
 (Four spaces here)OK (6 tests, 6 ran, 7 checks, 0 ignored, 0 filtered out, 0 ms)
1

Simply with sed:

<runalltests_output> | sed 's/^/    /'

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.