We help IT Professionals succeed at work.
Get Started

Creating a master file

177 Views
Last Modified: 2015-09-12
Hi guys,
I hope you are well and can help.

I have many text files, all with the same  format, that contain, as part of their file names, "summary_sorted.txt".
For example, summary_sorted_a_.txt,  summary_sorted_b.txt, summary_sorted_c.txt etc etc.

The format of each of these files is as follows:

--------------------------------------------------------------------------------------------------- summary_sorted_a.txt
abalone, adversary, aeroplane, at the park;

--------------------------------------------------------------------------------------------------- summary_sorted_b.txt
bat, benign, bipartisan;

I'd like to produce a script that will....

Examine each summary_sorted.txt file.
For each file examined, treat each file examined as 1 line, and copy its entire contents to a new file called master.txt. and
then add a blank line after its pasted contents, before the script goes on to look at the next summary_sorted.txt file.

As an example of what a master.txt file would look like based on the above, would be:

--------------------------------------------------------------------------------------------------- master.txt
abalone, adversary, aeroplane, at the park;

bat, benign, bipartisan;

Any help greatly appreciated.
Comment
Watch Question
Test your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 2 Answers and 5 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE