[英]How do i find all file Which as name String+Number to it Linux
I have to find all files whose name start with String + Number like below 我必须找到名称以String + Number开头的所有文件,如下所示
ABC123_filedemo.txt ABC123_filedemo.txt
AB_451_filetxt AB_451_filetxt
CD_789_demo.txt CD_789_demo.txt
demo_files_FD123.txt demo_files_FD123.txt
d_files_re_SD_456.txt d_files_re_SD_456.txt
I have tried this Command But Not working 我已经尝试过此命令但不起作用
export _date=`date "+%d_%m_%Y_%H_%M_%S"`
find . -type f -iname 'AB*' -exec mv {} /Demo_files"_"$_date \;
Is ".txt" relevant? 与“ .txt”相关吗? Then try: 然后尝试:
find ./ -regextype posix-extended -regex '.*[a-zA-Z]+.*[0-9]+\.txt' -exec <your stuff>
inspired by: https://stackoverflow.com/a/5249797/10514446 灵感来自: https : //stackoverflow.com/a/5249797/10514446
This looks like a simple example: 这看起来像一个简单的示例:
find ./ -name "[a-zA-Z]*[0-9]*"
Every file here needs to start with a letter 'a'-'z' (small or large caps) and somewhere in the filename you need a digit [0-9]
. 此处的每个文件都必须以字母'a'-'z'(大写或大写)开头,并且在文件名中的某个位置需要数字[0-9]
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.