Using regex with `rename` version from `util-linux`

后端 未结 2 774
温柔的废话
温柔的废话 2021-01-05 00:25

I’m using a GNU/Linux distribution where the utility rename comes from util-linux and I want to make full use of regular (Perl or POSIX) expression

2条回答
  •  感情败类
    2021-01-05 01:24

    The following command gives the expected result with your input file but using the perl version:

    rename 's/foo_\D+(\d+)/foo_$1/' *.ext
    

    You can test the command using -n option to rename

提交回复
热议问题