Search code examples
findlineswc

I'm trying to find the files in a folder on linux server, which has more than 1000 lines..?


I'm trying to find the files in a folder on server, which has more than 1000 lines..? Is it possible with single command using pipes.? Thanks!


Solution

  • This should work for files containing spaces and or other special characters:

    find /path/to/files -type f -print0 \
        | xargs -0 -I '{}' awk 'NR > 1000 { print FILENAME; exit }' '{}'
    

    And this should give improved performance using multi-core CPUs, but only if you have GNU parallel:

    parallel -0 "awk 'NR > 1000 { print FILENAME; exit }'" ::: /path/to/files