Skip to content

Tag: find

grep without showing path/file:line

How do you grep and only return the matching line? i.e. The path/filename is omitted from the results. In this case I want to look in all .bar files in the current directory, searching for the term FOO Answer No need to find. If you are just looking for a pattern within a specific directory, this should suffi…

List all graphic image files with find? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …

Print md5sum of results of a find command in Linux

I am tryng to do checksum on all .jar files I can find in directory and its sub directories. Then print the filename with the checksum value to a file. this is what I have. I am trying to join two commands together that I know work individually. Any help appreciated. Answer You could use something like this t…

Grep inside all files created within date range

I am on the Ubuntu OS. I want to grep a word (say XYZ) inside all log files which are created within date range 28-may-2012 to 30-may-2012. How do I do that? Answer This is a little different from Banthar’s solution, but it will work with versions of find that don’t support -newermt and it shows h…

regular expression to exclude filetypes from find

When using find command in linux, one can add a -regex flag that uses emacs regualr expressions to match. I want find to look for all files except .jar files and .ear files. what would be the regular expression in this case? Thanks Answer You don’t need a regex here. You can use find with the -name and …

linux find regex

I’m having trouble using the regex of the find command. Probably something I don’t understand about escaping on the command line. Why are these not the same? Bash, Ubuntu Answer Regular expressions with character classes (e.g. [[:digit:]]) are not supported in the default regular expression syntax…