Why does this not work?
ls *.txt | xargs cat > all.txt
(I want to join the contents of all text files into a single ‘all.txt’ file.)
find with -exec should also work, but I would really like to understand the xargs syntax.Thanks
Answer
ls *.txt | xargs cat >> all.txt
might work a bit better, since it would append to all.txt instead of creating it again after each file.
By the way, cat *.txt >all.txt
would also work. 🙂
Attribution
Source : Link , Question Author : ajo , Answer Author : Janne Pikkarainen