Sample Header Ad - 728x90

I want to find lines where a specific word appears in a file along with line number and take the line numbers in an array .How to do that in bash?

3 votes
2 answers
1119 views
This returns line numbers but they are in a string:
grep -n -F -w $word $file | cut -d : -f 1
Asked by Arpan Koley (31 rep)
Aug 24, 2023, 05:01 AM
Last activity: Aug 26, 2023, 04:11 AM