<<- delimiter
(or <<- 'delimiter'
or <<- "delimiter"
), it starts creating a multi-line buffer using these rules:TAB
and then exactly delimiter
will end the contentsTAB
on each line will be removedstdin
to the program of your choice. For example:cat
on line 3 to awk
and a backslash (\
) was placed before TAB
series we want to retain.awk
command removes any occurrences of backslash at the start of a line if the following character is TAB
.awk
the syntax is PREDICATE { ACTION }
. The { ACTION }
part is optional and if not present, defaults to { print }
which prints the contents of $0
, usually the entire line but this can be modified. The PREDICATE
part is either a series of conditions or a keyword such as BEGIN
or END
. If you have an action without predicate, the action is run for every line. When using one or more conditions as a predicate without an action, if the predicate as-a-whole evaluates to non-zero, the line is printed.sub()
in the predicate part of the awk
syntax would normally mean the default action of { print }
will only execute for the line if the regular expression /^\\\t/
is found. However, because we have placed ||1
after the invocation of sub()
in the awk
predicate, a zero result from sub()
is translated to one. The result is that every line is printed, regardless of whether sub()
was able to make a replacement.TABTEST
:TABTEST
does not need to be modified because the stripping of leading tab characters by using >>-
happens only on pre-interpolated text. That is to explain that line 4 of the above script, leading tabs are stripped on $( cat TABTEST )
before it is translated into the contents of TABTEST
, not after.