Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

find lacks the option -printf, now what?

Tags:

find

macos

printf

I have not found a reason why Mac's find does not have the option -printf. Apple normally decides to take options out which are not orthogonal to the other commands?

How can you reach the same result as the following command in Mac without coreutils?

find . -printf "%i \n"         // command in Ubuntu 
like image 730
Léo Léopold Hertz 준영 Avatar asked Apr 15 '09 17:04

Léo Léopold Hertz 준영


People also ask

Why do people lose in options?

For example, when the stock price goes up, call options benefit and put options lose the premium. When stock prices go down, put options make money but call options lose the premium. There is another angle to it. Even if the stock price remains static, an increase in volatility can increase the option price.

What happens if you lose in options?

A call option is a right to buy without the obligation and a put option is a right to sell without the obligation. Since the option loss is restricted to the premium paid, the maximum loss is capped at the total premium. Once the option cost is covered, the option profit can be unlimited on the upside.

Can you lose a lot with options?

Here's the catch: You can lose more money than you invested in a relatively short period of time when trading options. This is different than when you purchase a stock outright. In that situation, the lowest a stock price can go is $0, so the most you can lose is the amount you purchased it for.


1 Answers

It's not that Apple removes options, it's that OS X's UNIX underpinnings are mostly derived (circuitously) from FreeBSD, many parts of which can be traced back to the original UNIX... as opposed to the GNU utilities, which are re-implementations with many features added.

In this case, FreeBSD's find(1) doesn't support -printf, so I wouldn't expect OS X's to either. Instead, this should work on a BSD-ish system:

find . -print0 | xargs -0 stat -f '%i ' 

It'll fail on a GNU-userland system, though, where you'd write xargs -0 -r stat -c '%i ' because xargs(1) and stat(1) behavior is different.

like image 70
ephemient Avatar answered Sep 22 '22 05:09

ephemient