Using 'find' to return filenames without extension

前端 未结 9 1621
无人及你
无人及你 2020-12-15 22:37

I have a directory (with subdirectories), of which I want to find all files that have a \".ipynb\" extension. But I want the \'find\' command to just return me these filenam

9条回答
  •  青春惊慌失措
    2020-12-15 23:05

    find . -type f -iname "*.ipynb" | grep -oP '.*(?=[.])'
    

    The -o flag outputs only the matched part. The -P flag matches according to Perl regular expressions. This is necessary to make the lookahead (?=[.]) work.

提交回复
热议问题