Quantcast
  1. Sign up now and join over 35,000 northwest gun owners. It's quick, easy, and 100% free!

Completely off topic! UNIX!!

Discussion in 'Off Topic' started by SgtKashim, Nov 9, 2008.

  1. SgtKashim

    SgtKashim Wilsonville, Oregon Member

    Messages:
    209
    Likes Received:
    12
    So, I had an assignment for one of my unix class, we've been working on regular expressions. It took me a while, and I finally found a solution for this problem, but I can't help feeling there must be a more elegant and efficient way to do this...

    Problem statement:

    Display the full file name (including the full path) and file size of all files whose name (excluding the path) is longer than 10 characters.

    My ugly solution:

    find / . -printf '%p::%s bytes\n' 2> /dev/null | rev | egrep '::[a-Z\.]{10,}' | rev

    Any of you fellow computer people have a better way?