I use grep
(egrep) to search text a log. I have multiple txt files to search in the same folder. By default, grep output file name (full path), with math result.
The directory path is long so it looks ugly.
However, if I use -h
option, it only give me match result but not file name, which is not good either, because sometimes I need to know which file it is from.
for example, in folder bashsearch I have file1, file2, file3...
The default output is like this:
/mnt/c/Users/chili/Desktop/.../bashsearch/file1:match result 1
/mnt/c/Users/chili/Desktop/.../bashsearch/file2:match result 2
this looks ugly.
If I use -h
, the output is like this:
match result 1
match result 2
this is not good either.
What I want is like this:
file1:match result 1
file2:match result 2
How to achieve this please? Any help is highly appreciated.