I am trying to find text files using bash that contain nothing but a specific pattern on 1 line of the file.
For example, I have the following textfile:
1234123 123412341 0000 23423 23422
121231 123123 12312 12312 1231
567 567 43 234 12
0000
929 020 040 040 0000
This file contains a line (line 4), that exclusively has pattern 0000
.
I tried ls | grep 0000
, however, that returns also the files in which the pattern is located elsewhere in the file and not necessarily 'solo' on a line.
How do you find a pattern using bash that is exclusively present on a single line of the file?