Chenna Black |1|76.00|Chenna
Chenna White big|1|102.00|Chenna
Chenna White small|1|82.00|Chenna
Dhal-Gram|1|78.00|Dhal
Dhal-Moong|1|76.00|Dhal
Dhal-Orid|1|72.00|Dhal
Dhal-Toor|1|68.00|Dhal
Dhal-Green gram|1|88.00|Dhal
Rajma-Black|1|72.00|Rajma
Rajma-Pink|1|80.00|Rajma
Rice-Basmanthi|1|80.00|Rice
Rice-Boiled|1|42.00|Rice
Rice-Idly|1|33.00|Rice
Rice-IGBasamanthi|1|99.00|Rice
Rice-Karanatka Ponni|1|38.00|Rice
Rice-Nirapara Silky|1|235.00|Rice
Rice-Raw|1|40.00|Rice
Rice-RoastedGram|1|100.00|Rice
its my input file. suppose if i check rice item from input file. it will display the rice item and rice item price also.And if i write non -available item from the file like " sugar " item . it will display the "item is not found".
you can also do it in perl:
perl -F"|" -ane 'BEGIN{$f=0}if(/Rice/){print;$f=1}END{print "not found\n" unless($f)}' your_file