Welcome to Northwest Firearms
Join our community, sign up for free today!
Sign Up

Completely off topic! UNIX!!

Messages
209
Reactions
13
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?
 

NEW CLASSIFIED ADS

LATEST REVIEWS

  • Klickitat County Firearms Training Facility
    4.00 star(s)
    Not really a range guy, as in I am 53 years old and today is the very first time I have been to an actual managed shooting range. Also, not a WA...
    • CRBMoA
  • Supporting Vendor Oregon Arms & Ammunition
    5.00 star(s)
    I've made several purchases here over the past few years and I've had a great experience every time. Prices are good, their staff is helpful, and...
    • Joe Link
  • Big Iron Armory
    5.00 star(s)
    It's great to have an LGS inside Portland Metro. Walt and Noah have put care into setting good prices and acquiring quality firearms and...
    • kr0ptkin
  • Supporting Vendor Lucky Sporting Goods
    5.00 star(s)
    Well I finally got around to taking pics of the Cerakoting work that Jeremy of Lucky Sports did for my wife and me about 3 weeks ago. We couldn't...
    • jg rider
  • Supporting Vendor Lucky Sporting Goods
    5.00 star(s)
    Here's more work that Jeremy did for me The first 3 pics are of an RIA frame that I had Cerakoted years back by an outfit in Molino. I had Jeremy...
    • jg rider

Staff online

  • Kruel J
    Moderator of the Coriolis effect