Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
There's no *need* for printf either. Assuming the OP is using bash, printf is not a shell builtin, a new process is spawned either way. Indeed there are many way to get that output, feel free to post as many of them as you like.
printf is a builtin command in bash, ksh, dash; tr is an external command (many, many times slower).
find will locate the file that matches the -name pattern - then the cat will find all files that match the pattern "dir*/*.dat" - for EACH file that matches the -name pattern.
You want to use the file that find found, you replace the "cat dir*/*.dat" with "cat '{}'" which will execute cat only once for each file.
The major problem is that find will use whatever order the files were added to the given directory - and that may not be the order you want them in.
Both are incorrect in that the cat command is completely ignoring whatever find located. All you will get from either one is, "find: missing argument to `-exec'" and an empty output file.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.