Swap string patterns listed one per line in an input file
Use cargo
to build:
cargo install --force --path .
Given a set of patterns:
aa bb
ce do
xo ee
We can rewrite a file:
aaaace ao do cece xo xxxo
... like this:
strswap -s patterns.txt -i text.txt >rewritten.txt
# bbbbdo ao do dodo ee xxee
The patterns are applied in order given in the file.