Hi can someone help me out the code "./generate 1000 50 | ./find 127" doesn't find the haystack. And I even removed the "./find 127" and went through the generated numbers but still didn't see the number "127"

1 Answer 1


The "haystack" is the list of numbers. 127 is the "needle", and it's the 331st of the 1000 numbers, just verified using

./generate 1000 50|grep -nx "127"

grep searches the standard input or files for occurrences of a pattern. -n tells it to print line numbers, -x forces the whole line to match the pattern, so I don't get lines just containing 127.

So the "needle" 127 is in that "haystack".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .