0

Hello everyone, I have 3000 documents with me. I want to combine the content of those 3000 documents in one single document. I used

cat *.html > Combined_Text.txt

command to do the process. But, I would like to have the data of one document per line in the Combined_Text.txt which means I should just be having 3000 lines of content (one document per line). How to do it? Please help!

Sanathana
  • 284
  • 4
  • 16

1 Answers1

0

The following command will remove new lines from every html and then append the files to each other in Combined_Text.txt.

 for f in *.html; do cat $f | tr -d '\n' >> Combined_Text.txt; echo "" >> Combined_Text.txt; done;

That second echo seems to inelegant, I'm sure there is a better way to put the files on their own lines, but it does the job.

AlecBrooks
  • 524
  • 4
  • 12