Table of Contents
Now that you know all the basic Pantry options, you're ready to combine them and put them to use! This chapter will show you how.
Often you will wish to know the nutrient makeup of a
particular food. Suppose for example that you want to know how
many calories are in a fresh apple. You figure that
master
already has such a food, but
you don't know exactly what it would be. So first you
search for apple
to see what comes
up.
Example 3.1. Searching for apples
$
pantry --ignore-case --name apple --print names master
Babyfood, cereal, oatmeal, with applesauce and bananas, junior HEALTHY CHOICE Traditional Meat Loaf w/Brown Sauce, Mashed Potatoes, Green Beans and Apple Praline Crisp, frozen meal Pie, apple, commercially prepared, enriched flour Apples, dried, sulfured, stewed, without added sugar Babyfood, dessert, fruit pudding, pineapple, strained Cereals ready-to-eat, GENERAL MILLS, OATMEAL CRISP, APPLE CINNAMON Cereals ready-to-eat, QUAKER, QUAKER APPLE ZAPS VERYFINE APPLE QUENCHERS Apple Raspberry Cherry Juice Cocktail, ready-to-drink Cereals, QUAKER, Instant Oatmeal, NUTRITION FOR WOMEN, Apple Spice, dry English muffins, raisin-cinnamon (includes apple-cinnamon) Babyfood, cereal, rice, with applesauce and bananas, strained Babyfood, cereal, oatmeal, with applesauce and bananas, strained Pineapple, raw, extra sweet variety Cereals ready-to-eat, KELLOGG, KELLOGG'S APPLE CINNAMON SQUARES MINI-WHEATS Custard-apple, (bullock's-heart), raw [ trimmed to save space ]
It turns out that this search returns 163 results.
There must be a way to narrow this down. Well, many
foods will have the word "Apple" in their name,
including many foods that are not even fruits (desserts,
for example). A good way to narrow your results is to
use the --group
option:
Example 3.2. Searching for apples, with the
--group
option
$
pantry --ignore-case --name apple --group fruits --print names master
Custard-apple, (bullock's-heart), raw Pineapple juice, frozen concentrate, unsweetened, undiluted Apples, dried, sulfured, stewed, without added sugar Apple juice, frozen concentrate, unsweetened, undiluted, with added ascorbic acid Fruit salad, (peach and pear and apricot and pineapple and cherry), canned, light syrup, solids and liquids Pineapple juice, canned, unsweetened, without added ascorbic acid Apple juice, frozen concentrate, unsweetened, diluted with 3 volume water without added ascorbic acid Fruit salad, (peach and pear and apricot and pineapple and cherry), canned, extra heavy syrup, solids and liquids Pineapple, canned, water pack, solids and liquids Pineapple, raw, traditional varieties Apple juice, frozen concentrate, unsweetened, undiluted, without added ascorbic acid Pineapple, canned, light syrup pack, solids and liquids Pineapple juice, canned, unsweetened, with added ascorbic acid Apples, dehydrated (low moisture), sulfured, uncooked Pineapple, raw, extra sweet variety [ trimmed to save space ]
That is still a lot more than we are looking for,
including a bunch of things that merely have
"Apple" in their name. What if we use a
regular expression to limit the results only to foods
whose name
trait begins with
apple
?
Example 3.3. Searching for apples using a regular expression
$
pantry --ignore-case --name ^apple --group fruits --print names master
Apples, frozen, unsweetened, heated Apple juice, frozen concentrate, unsweetened, undiluted, with added ascorbic acid Apple juice, canned or bottled, unsweetened, with added ascorbic acid Apple juice, frozen concentrate, unsweetened, undiluted, without added ascorbic acid Apple juice, frozen concentrate, unsweetened, diluted with 3 volume water without added ascorbic acid Apples, dehydrated (low moisture), sulfured, uncooked Apples, raw, without skin, cooked, boiled Applesauce, canned, sweetened, with salt Apples, canned, sweetened, sliced, drained, unheated Apples, dried, sulfured, stewed, with added sugar Apples, raw, without skin, cooked, microwave Applesauce, canned, sweetened, without salt Applesauce, canned, unsweetened, with added ascorbic acid Apples, frozen, unsweetened, unheated Apples, dried, sulfured, uncooked Apple juice, canned or bottled, unsweetened, without added ascorbic acid Apples, raw, with skin Apples, raw, without skin Apples, dried, sulfured, stewed, without added sugar Apples, canned, sweetened, sliced, drained, heated Apple juice, frozen concentrate, unsweetened, diluted with 3 volume water, with added ascorbic acid Applesauce, canned, unsweetened, without added ascorbic acid Apples, dehydrated (low moisture), sulfured, stewed
That buffer is manageable enough to scan to see
what we are looking for. Looks like Apples,
raw, with skin
is what we are looking
for. We want to know how many calories are in an apple.
To do that, first we need to see what units are
available for Apples, raw, with
skin
:
Example 3.4. Available units for an apple
$
pantry --name "Apples, raw, with skin" --print names-units \
>
master
Apples, raw, with skin cup, quartered or chopped large (3-1/4" dia) (approx 2 per lb) NLEA serving medium (2-3/4" dia) (approx 3 per lb) cup slices small (2-1/2" dia) (approx 4 per lb)
Notice how we combined the
names
and
units
reports rather than
using just a units
report. This
is a good idea because otherwise, your report might
actually contain results for more than one food, but you
would not know this if you used only a
units
report.
Finally, we use the change options to take the apple
from the master
file, change it to
the characteristics we're interested in, and print a
report:
Example 3.5. How many calories are in an apple?
$
pantry --name "Apples, raw, with skin" --c-unit large \
>
--c-qty 1 --print traits-nuts master
Apples, raw, with skin Group: Fruits and Fruit Juices Refuse: 8 percent Core and stem 1 large (3-1/4" dia) (approx 2 per lb) (212g) Nutrient Amount %G %TOT ------------------------------------------------------- Calories 110 kcal 6 100 Total Fat 0 g 1 100 Saturated Fat 0 g 0 100 Cholesterol 0 mg 0 0 Sodium 2 mg 0 100 Total Carbohydrate 29 g 10 100 Dietary Fiber 5 g 20 100 Sugars 22 g NA 100 Protein 1 g 1 100 Vitamin A 114 IU 2 100 Vitamin C 10 mg 16 100 Calcium 13 mg 1 100 Iron 0 mg 1 100