On Mon, 24 Jan 2022 07:28:24 +0200, Itschak Mugzach wrote:
>Sorry: find / -name *.txt -exec echo {}; echo {} >> all.txt ; cat {}
>>>all.txt \;
>
I doubt that you want to search the entire filesystem, "/".
Note that "all.txt" might be both input and output which may be undesirable.
Then:
534 $ rm -f all.txt
535 $ find . -name \?.txt -exec sh -xc '
echo {}; echo {} >> all.txt ; cat {} >>all.txt' \;
sh 1+ echo ./d.txt
./d.txt
sh 1+ echo ./d.txt
sh 1+ cat ./d.txt
sh 1+ echo ./s.txt
./s.txt
sh 1+ echo ./s.txt
sh 1+ cat ./s.txt
Or, simpler, and perhaps sufficient:
head -9999 ?.txt | tee all.txt
Or:
for I in ?.txt; do echo $I; echo $I >> all.txt; cat $I >> all.txt; done
-- gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN