mrtomrod / binaryfilesearch Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
The sort suggested by the current README does not make BinaryFileSearch work on keys (first column) of varying length.
I figured out this is because the module expects strict prefixes to come first, while bash sort
puts them at the end. For example, the module expects
ban
banana
cat
whereas sort
produces
banana
ban
cat
We can obtain the expected sort by first padding the keys with whitespaces (assuming the keys don't have whitespaces or characters strictly before in ASCII) in awk, and removing them after sorting:
awk 'BEGIN {FS=OFS=","} {s = sprintf("%*s",N-length($1),""); print $1 s,$2}' input.csv \
| LC_ALL=C sort --key=1 --field-separator=','
| sed 's/ //g' > output.csv
where N
is the max size of keys, which can be obtained using:
cut -d ',' -f 1 input.csv | wc -L
What do you think about moving the code for _enter_() to the end of _init_()? I don't always want to indent my entire program, but rather just store the open file in a variable. As written, I need to call _enter_() explicitly, which feels a bit strange.
Super library by the way. Just what I was looking for.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.