43 lines
750 B
Markdown
43 lines
750 B
Markdown
# Bash Fast Replace
|
|
|
|
An implementation in bash.
|
|
|
|
## Usage
|
|
|
|
To create the corpus.csv and pairs.csv files. And perform the replacements:
|
|
|
|
```bash
|
|
make install # create corpus and pairs
|
|
make run # create file with the replaced values
|
|
```
|
|
|
|
Then to test:
|
|
|
|
```bash
|
|
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.
|
|
````bash
|
|
$ 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
|
|
```` |