got a file as y.txt
1 abc,def,ghj
2 defj,abc.kdm,ijk
3 lmn,cbk,mno
4 tmp,tmop,abc,pkl
5 pri,chk,cbk,lmo
6 def,cbk.pro,abc.kdm
i want to search in the above file the key word like abc
looking for two outcomes by passing the parameter value as abc into function and the two outocmes are :
1) how many lines the abc is available. It should search only for abc and not abc.kdm.
count should be 2.
2) also the line numbers of the respective lines where abc is available like below.
1 abc,def,ghj
4 tmp,tmop,abc,pkl
ck.sh abc
it should give two outcomes
can someone give me the solution for this ?
---------- Post updated at 10:10 PM ---------- Previous update was at 10:06 PM ----------
all doing in bash