i’m currently writing a linux script that has the following code:
echo "\nCompiled on:\n `gcc --version`\n"
the output is formatted as such:
Compiled on: gcc (GCC) 3.4.4 etc... This is free software...
however i want the command to be formatted like this:
Compiled on:
gcc(GCC) 3.4.4 etc...
This is free software...
how can i format the text so that each LINE outputted from the gcc --version command has its own tab?
How about:
The output of
gcc --versionis piped tosed, which adds a tab at the beginning of the line.Alternatively, you could use awk (could be shorter if you don’t need the extra newlines):