With the GNU find
command (GNU findutils 4.4.2), a regular expression can be used to search for files. For example:
$ find pool -regextype posix-extended -regex ".*/mypackage-([a-zA-Z0-9.]+-[0-9]{1,2})-x86_64.pkg.tar.xz+"
Is it possible to extract the capture group defined by that expression and use it in a -printf
argument?
So, given a found file called pool/mypackage-1.4.9-1-x86_64.pkg.tar.xz
, I would like to include the 1.4.9-1
part in a printf
expression.
Is this possible?
-print0
and pipe to GNUsed -Ez
(possibly followed bytr '\0' '\n'
) – Stéphane Chazelas Jun 26 '14 at 11:38[a-zA-Z]
only makes sense in the C/POSIX locale. – Stéphane Chazelas Jun 26 '14 at 11:50