henri_007 wrote: ↑Mon May 21, 2018 12:44 pm
Matching criteria is code of products. In line I have, code, name, price, dateOfManufacturing,color, etc. and I need to read informations of products with code 10457 (example)
Um, you're almost perfectly describing a database table there. While grep will work for simple queries, the shell code will get really slow and fiddly if someone asks you how many blue 10457's were made in Q3 2017.
While it's likely to be a bit slower than raw grep calls, the
massively-unhelpfully-named “
q” allows you to query text files as if they were an SQL database. It's in the Raspbian repo as
python3-q-text-as-data.
grep's fine for easily-defined problems like a phone directory, but big text searches benefit from an engine like
Lucene. It brings typo-tolerant searches, ranking, search ranges, searching while updating, … none of which grep does well, if even at all.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.