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
Apple cider-flavored drink, powder, low calorie, with vitamin C, prepared English muffins, raisin-cinnamon (includes apple-cinnamon) Babyfood, cereal, high protein, with apple and orange, prepared with whole milk Applesauce, canned, unsweetened, without added ascorbic acid Pineapple, canned, light syrup pack, solids and liquids Babyfood, fruit, bananas and pineapple with tapioca, strained Babyfood, fruit, apple and raspberry, junior Apple juice, frozen concentrate, unsweetened, undiluted, with added ascorbic acid Babyfood, apple-banana juice Fruit salad, (peach and pear and apricot and pineapple and cherry), canned, extra heavy syrup, solids and liquids Babyfood, fruit, apple and raspberry, strained Pie fillings, apple, canned Pineapple, frozen, chunks, sweetened Scrapple, pork Babyfood, fruit, bananas with apples and pears, strained [ 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
Apples, dried, sulfured, uncooked Apple juice, frozen concentrate, unsweetened, undiluted, with added ascorbic acid Pineapple, canned, water pack, solids and liquids Apples, dried, sulfured, stewed, without added sugar Apple juice, frozen concentrate, unsweetened, undiluted, without added ascorbic acid Apples, raw, without skin, cooked, boiled Apple juice, frozen concentrate, unsweetened, diluted with 3 volume water, with added ascorbic acid Sugar-apples, (sweetsop), raw Applesauce, canned, unsweetened, without added ascorbic acid Pineapple, raw, traditional varieties Pineapple, canned, light syrup pack, solids and liquids Applesauce, canned, sweetened, with salt Fruit salad, (peach and pear and apricot and pineapple and cherry), canned, extra heavy syrup, solids and liquids Pineapple, canned, heavy syrup pack, solids and liquids Crabapples, raw [ 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, dried, sulfured, uncooked Apples, dried, sulfured, stewed, without added sugar Apple juice, frozen concentrate, unsweetened, undiluted, without added ascorbic acid Apples, raw, without skin, cooked, boiled Apple juice, frozen concentrate, unsweetened, diluted with 3 volume water, with added ascorbic acid Applesauce, canned, unsweetened, without added ascorbic acid Apples, dried, sulfured, stewed, with added sugar Apple juice, frozen concentrate, unsweetened, undiluted, with added ascorbic acid Applesauce, canned, sweetened, with salt Apple juice, canned or bottled, unsweetened, with added ascorbic acid Applesauce, canned, unsweetened, with added ascorbic acid Applesauce, canned, sweetened, without salt Apples, raw, with skin Apple juice, canned or bottled, unsweetened, without added ascorbic acid Apples, frozen, unsweetened, heated Apples, raw, without skin Apples, dehydrated (low moisture), sulfured, uncooked Apples, raw, without skin, cooked, microwave Apples, frozen, unsweetened, unheated Apple juice, frozen concentrate, unsweetened, diluted with 3 volume water without added ascorbic acid Apples, canned, sweetened, sliced, drained, heated Apples, dehydrated (low moisture), sulfured, stewed Apples, canned, sweetened, sliced, drained, unheated
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 NA Sodium 2 mg 0 100 Total Carbohydrate 29 g 10 100 Dietary Fiber 5 g 20 100 Sugars 22 g NG 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