I have a 16 track recording where each mono track is in a separate file. The recording is long (he pressed "Record" and then stopped about 45 minutes later.) I'd like to copy a portion from each track (for example from 0:38 to 4:15) and save each snippet to a new file (resulting in 16 shorter files.) I looked at the batch commands and saw how to select a range and copy/paste, but I didn't see how to either paste to a new file. Can this be done with Audacity (either the UI or CLI)?
From the UI you can select a section, copy it to a new file and use
Export > Export multiple to export all tracks as separate files. There is also an Option
Export Selection and
Export multiple also allows for splitting by Text labels. Sadly these cannot be combined so you can only either split by Selection or Text Labels or split the single tracks. Of course you can also use
Export multiple to export the whole tracks and then use other commandline tools like
ffmpeg for trimming. (By the way you can use
ffmpeg to trim without reencoding the files by doing
ffmpeg -ss 0:38 -to 4:15 -i infile -acodec copy outfile. This prevents generation errors from multiple encodings with lossy encodings and it is extremely fast.)
I'm not sure if Audacity can do it, but there is another free, cross-platform program SoX which can do exactly what you want (possibly driven by a bash script). The SoX function you need is called 'trim'.
There are also several other tools available: ecasound, mp3splt, ffmpeg etc.