is there a way to do this kind of substitution in Awk, sed, ...?
I have a text file with sections divived into two blank lines;
section1_name_x
dklfjsdklfjsldfjsl
section2_name_x
dlskfjsdklfjsldkjflkj
section_name_X
dfsdjfksdfsdf
I would to replace every "section_name_x" by "#section_name_x", this is, how to replace the next string after match (every) two blank lines?
Thanks,
Steve,
hm....
Given your example data why not just
some seds support
sed -i
ORsed -i""
to overwrite the existing file, avoiding the&& mv ...
shown above.The reg ex says, section must be at the beginning of the line, and can optionally contain a number or NO number at all.
IHTH