How do I use cat (presumably with a sh script) to combine all the files in a directory without listing them individually.
Thank you for your patience with this very elementary question.
How do I use cat (presumably with a sh script) to combine all the files in a directory without listing them individually.
Thank you for your patience with this very elementary question.
try this:
for file in *; do cat $file >> newfile; done
Or simply (if no subdir present):
cat dirname/* >newfile
Thank you for your replies!
Unfortunately, here is a partial list of my file names:
1 INSERM Avenir, Epidemiology of Sudden Death in the Population, Paris XI University.rtf
24% mortality in the ICD group, 55% in the pharmacological therapy group, and 48% in the group receiving no therapy.rtf
A frequently observed and notable aspect of SCD is its unpredictable and seemingly random nature of onset. Accordingly, one of.rtf
A multicenter experience with novel subcutaneous patch.rtf
A subcutaneous ICD system is a very useful new treatment approach. This technique is especially suitable for young children and.rtf
As you can see, they contain spaces, punctuation marks, and pretty much every other forbidden thing Unix can imagine.
What happens when I do "cat dirname/* > newfile" is that I just get the first file.
When I try the script: "for file in *; do cat $file >> newfile; done", it does not like the file names.
Sorry for the horrible complication...