Hopefully I'm missing something obvious.
I've got a file that contains some lines like:
| A | B | C |
|-----------|
Ignore this line
| And | Ignore | This |
| D | E | F | G |
|---------------|
I want to find the |----| lines, remove those... and replace all of the | characters with a ^ in the preceding line. e.g.
^ A ^ B ^ C ^
Ignore this line
| And | Ignore | This |
^ D ^ E ^ F ^ G ^
So far I've got:
perl -0pe 's/^(\|.*\|)\n\|-+\|/$1/mg'
This takes input from stdin (some other modifications have already happened with sed)... and it's using -0 and /m to support multiline replacements.
The match seems to be correct, and it removes the |----| lines, but I can't see how I can do the | to ^ substitution with the $1 (or \1) backreference.
I can't remember where I did it before, but another language allowed me to use ${1/A/B} to substitute A to B, but that's upsetting perl.
And I've been wondering if this is where /e or /ee could be used, but I'm not familiar enough with perl on how to do that.