This is another one-liner ... from shell point of view (you can remove \
and newline
to make it one line).
Make sure \
is always last character of the line and no space after that.
gawk '{\
for(i=1;i<NF;i++)\
{\
if(match($i,/\]\.\[/)>0)\
{\
for(k=1;k<length($i);k++)\
{\
c=substr($i,k,1);\
if(c!="[" && c!="]")\
printf("%s",c);\
}\
printf(" ");\
}\
}\
printf("\n");\
}' example.txt
Anyway, it would be useful to put the gawk-code in between '
and '
into a file (file.awk, in file.awk remove all \
) and then call, gawk like so, meaning test.awk starts with {
and ends with }
. It might not be an elegant solution, but you can add a lot more to this, like many variables, a whole program, subroutines, ...
gawk -f test.awk example.txt
Output:
fox.jumps
the.quick fox.jumps