In post #14
grail suggested elimination of unnecessary "g" modifiers in my "no branching" solution. That changes the code to this ...
Code:
sed 's/^create/~create/' $InFile \
|paste -sd" " \
|cut -d~ -f2- \
|tr "~" "\n" \
|sed 's/\(\b[a|i]s\b\).*/\1/' \
>$OutFile
As a refinement I changed
tr to
sed ...
Code:
sed 's/^create/~create/' $InFile \
|paste -sd" " \
|cut -d~ -f2- \
|sed 's/~/\n/g' \
|sed 's/\(\b[a|i]s\b\).*/\1/' \
>$OutFile
... and the code still works.
Then I combined two
seds this way ...
Code:
sed 's/^create/~create/' $InFile \
|paste -sd" " \
|cut -d~ -f2- \
|sed 's/~/\n/g; s/\(\b[a|i]s\b\).*/\1/' \
>$OutFile
... and the code generates an incorrect output file.
Please explain what went wrong with this combination.
Daniel B. Martin