O'Reilly logo

Practical UNIX by Steve Moritsugu - DTR Business Systems

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using xargs to Process a List of Items

So far in this chapter, you have used filename wildcards to generate file lists on the command line, but that technique can fail (remember the error arg list too long) if there are too many files that match the pattern. Backquotes can be used to generate file lists from a pipeline of UNIX commands, giving you much more control over the files in the list. However, backquotes also can fail if too many filenames are generated, especially on older UNIX systems. The xargs command can succeed where these other techniques failed.

Test Your UNIX Skills

lp *[0-9][0-9]

Use this command to print all (nonhidden) files whose name ends in two or more digits. Assume that this command fails with the error arg list too ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required