Don't even attempt to thread a short piece of pipe, you will want to blow your brains out if you don't have the pricey, fancy tools it takes to do it. If you need shorter length nipples, the supply house should have what they generally call a job pack. It contains usually 4 of the various shorter sizes and two of the longer sizes up to 6-12 inches in length in the size you desire depending on the selected pipe size. By buying them in bulk, they are quite reasonably priced compared to buying piecemeal nipples. When done, you will have an assortment for the future projects and or modifications.
Now it is time for my annual lecture on pipe.
*Do not buy pipe and fittings from a hardware/box stores and never use galvanized. The aggravation you save will be yours.*