| Post Reply | RetroFed Forums Forum Index » Shell Scripting |
| Author | Message | ||
|---|---|---|---|
|
silas
lemmy.eco.br
silas@lemmy.eco.br Joined: 2023-07-12 |
Hi there! Usually, sed can be used in different ways, but most of the time we use it to match lines in a file against a fixed regexp. Some examples: This replaces ocurrences of regexp for "foo":
This prints all lines that have "foo", but will change the first "o" in the line for an "a":
and so on... But I tried to do a different thing, with no success: can I pass to sed a file with a bunch of regular expressions and test them against a fixed string? I tried to play with pattern space, hold space, with no success. It just seems impossible to use them (which would be the closest to "variables") in search commands. I know sed is Turing complete, but using it that way would maybe require to implement a regexp engine from scratch? Thanks! |
||
| 1 Original | |||
| Post Reply |
Back to top |