如何递归打印文件名小于25个字符的文件列表使用单行? [英] How can I recursively print a list of files with filenames shorter than 25 characters using a one-liner?
问题描述
我需要一个一行命令以满足以下要求。
从根目录搜索所有文件,只打印那些文件名长度小于25。
我想我们可以使用find命令来做下面的事情:
find / -type f | xargs basename ....
我不知道furthur命令。
在迅速参考了一些手册后,我得到了awk更合适,更容易理解。请看下面的解决方案,我想出了。
find / -type f | awk -F'/''{print $ NF}'| awk'长度($ 0) 25'
可能有一些语法错误。如果我错了,请纠正我。 >
I need a one line command for the below requirement.
Search all the files from the root directory and print only those files names whose file name length is less than 25.
I suppose we can do it with find command something like below:
find / -type f |xargs basename ....
I am not sure about furthur command.
After referring quickly some manuals i got to find awk to be more suitable and easy to understand.please see the below solution which i had came up with.
find / -type f|awk -F'/' '{print $NF}'| awk 'length($0) < 25'
may be there are some syntax errors.please correct me if i am wrong.
这篇关于如何递归打印文件名小于25个字符的文件列表使用单行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!