On Tue, Feb 01, 2022 at 03:04:06PM +0530, Pankaj Jangid wrote: > I tried to print ~40 pages using the following combination of commands: > > find . -name "pref***.pdf" | xargs lp > > The result was that a couple of pages were missed.
That command is fundamentally broken. It will fail if any of the matching filenames contain whitespace, single quotes or double quotes. A correct version would be: find . -name "pref*.pdf" -exec lp {} + That's the preferred one. If you're really old-fashioned and just cannot live without xargs, the first thing you must realize is that POSIX xargs is fundamentally incapable of doing this correctly. GNU xargs has a -0 extension, though, which makes it possible: find . -name "pref*.pdf" -print0 | xargs -0 lp That one is acceptable, albeit longer, less efficient and less portable.