$linuxcli.in _    [commands]    [tips & tricks]    [manpage]    [ESXi CLi]    [what is my ip?]    [pingme!]    [BIOS lock code]    [Code repo]


Find files from pattern


In below grep will provide filename, with the line number in output at where the pattern has been found, file command will received input by find command and it will search only regular files from the given path in this example /etc is the target location, awk will search for "ASCII" file format files.


# grep -niH "helloworld" \
> $(file $(find /etc -type f) | \
> awk -F: '/ASCII/{print $1}')

Last updated on 30 June 2023 10:43 am IST