fast-replace/bash-fast-replace
pxi ef30b5b012 ≡└( ‘o’)┘≡ 2023-12-30 22:41:51 +01:00
..
bin ¯\_(ツ)_/¯ 2023-12-30 22:35:09 +01:00
csv ¯\_(ツ)_/¯ 2023-12-30 22:35:09 +01:00
Makefile ¯\_(ツ)_/¯ 2023-12-30 22:35:09 +01:00
README.md ≡└( ‘o’)┘≡ 2023-12-30 22:41:51 +01:00

README.md

Bash Fast Replace

An implementation in bash.

Usage

To create the corpus.csv and pairs.csv files. And perform the replacements:

make install # create corpus and pairs
make run # create file with the replaced values

Then to test:

make test # Checks that the replacement worked

Conclusions

shuf is amazing. Using /dev/urandom directly produces broken pipe errors on when using Make.

Speed is not great... But no surprize there.

$ make install
./bin/pairs.sh
Generating csv/pairs.csv...
The generation of 1000 pairs took 2s
./bin/corpus.sh
Generating csv/corpus.csv...
 generated in 3s

$ make run
./bin/replace.sh
Generating replaced.csv...
Replacement took 3s

$ make test
./bin/test.sh
test OK