look(1): lines beginning with given string
linux.die.net
look(1): lines beginning with given string
1–10 of 47 posts
Re: look(1): lines beginning with given string
#2Re: look(1): lines beginning with given string
#3The universe of Unix filters never ceases to turn up things I haven't seen before. Other examples for those inclined: tac, sponge, pv, join, paste.
rev, vipe, comm, bfr, xxd
Re: look(1): lines beginning with given string
#4Re: look(1): lines beginning with given string
#5Is look of any use? Isn't grep fast enough?
"look(1): binary search for lines with a given prefix in a sorted file"
Which tells you exactly what the pros/cons are compared to plain grep.
Re: look(1): lines beginning with given string
#6Is look of any use? Isn't grep fast enough?
A better one-line description would be "look(1): binary search for lines with a given prefix in a sorted file" Which tells you exactly what the pros/cons are compared to plain grep.
% du -h a
1.1G a
% time look 'dog' a | wc -l
53856
real 0m0.021s
user 0m0.020s
sys 0m0.003s
% time grep '^dog' a | wc -l
53856
real 0m28.593s
user 0m0.977s
sys 0m2.223s
Ok grep performed worse than what I expected (sort took a long time though).Re: look(1): lines beginning with given string
#7Earlier quoted context omitted.
A better one-line description would be "look(1): binary search for lines with a given prefix in a sorted file" Which tells you exactly what the pros/cons are compared to plain grep.
I created a 1.1G file with dictionary words and timed... % du -h a 1.1G a % time look 'dog' a | wc -l 53856 real 0m0.021s user 0m0.020s sys 0m0.003s % time grep '^dog' a | wc -l 53856 real 0m28.593s user 0m0.977s sys 0m2.223s Ok grep performed worse than what I expected (sort took a long time though).
Re: look(1): lines beginning with given string
#8look "#" .zshrc
There are really a lot more comments (lines starting with '#') in my .zshrc then the first line.
Re: look(1): lines beginning with given string
#9Re: look(1): lines beginning with given string
#10Earlier quoted context omitted.
A better one-line description would be "look(1): binary search for lines with a given prefix in a sorted file" Which tells you exactly what the pros/cons are compared to plain grep.
I created a 1.1G file with dictionary words and timed... % du -h a 1.1G a % time look 'dog' a | wc -l 53856 real 0m0.021s user 0m0.020s sys 0m0.003s % time grep '^dog' a | wc -l 53856 real 0m28.593s user 0m0.977s sys 0m2.223s Ok grep performed worse than what I expected (sort took a long time though).
Ignoring memory hierarchy, naturally 'look' would be O(log n) while grep would be O(n).
Special input (sorted in this case) of course often calls for matching algorithms, when speed matters.