How to strip leading “./” in unix “find”?

前端 未结 7 1948
盖世英雄少女心
盖世英雄少女心 2020-11-29 17:14
find . -type f -print

prints out

./file1
./file2
./file3

Any way to make it print

file1
file2
fil         


        
7条回答
  •  感动是毒
    2020-11-29 17:34

    Find only regular files under current directory, and print them without "./" prefix:

    find -type f -printf '%P\n'
    

    From man find, description of -printf format:

    %P     File's name with the name of the command line argument under which it was found removed.

提交回复
热议问题