My own bash script searches compilation logs (higher-level logs generated by Bitbake cooker while cross-building a Linux software package) for compilation command line strings. Those command strings in searched logs are huge in length, more than 2300 columns of ascii text (due several -I's and -W's). Log file is searched for compilation command line strings using following regex
grep -E -e "^${TARGETCANONICAL}${COMPCMDPATT}"
where
TARGETCANONICAL='arm-oe-linux-gnueabi-'
COMPCMDPATT="gcc[[:space:]].+[[:space:]]-c[[:space:]].+\w+\.c$"
Used grep command is constructed to print out each line matching given pattern, with no manipulation of matching input line printed to grep output. Ubuntu is build machine.
Each compilation command string in log-file includes at few points sequences of multiple subsequent spaces (blanks). For instance:
-ftree-vectorize -Wno-error=maybe-uninitialized
In lines printed out by grep (regex matches) all those original sequences of blanks are consolidated to one single blank, whitespace. That consolidation of whitespaces is not what was expected here.
What might be the possible reason?
Update: grep output goes to command substitution (bash expansion) whose output is assigned to variable. Then it is printed out using echo or used in compound conditional command - which is the level where myself conducts observations/debugging. Possibly rootcause of observed phenomenon is located even in subsequent command expansion or in assignment.