I think you want to use the a
as a state variable, and act according to its state.
First, it must be 6\.4
in a regular expression, because an unescaped dot means "any character".
The action is missing.
If it's to append the current line, then it could be
awk 'a{buf=(buf FS $0)} /Module State/{a=1; buf=$0} /6\.4/{a=0; print buf}' FILE.csv
I use a buf variable:
- if
a == 1
then add the current line tobuf
with a leading space (append) - if
Module State
is met then seta
to1
and store the line inbuf
- if
6.4
is met then seta
to0
and printbuf
In this case it's doable without buffering:
awk 'a{printf " %s", $0} /Module State/{a=1; printf "%s", $0} /6\.4/{a=0; printf "\n"}' FILE.csv
- if
a == 1
then print the current line with a leading space and no ending newline (append) - if
Module State
is met then seta
to1
and print the current line without a newline - if
6.4
is met then seta
to0
and print an ending newline
I see opening and closing quotes, so maybe you just need my tip