Link to home
Start Free TrialLog in
Avatar of Simon336697
Simon336697Flag for Australia

asked on

Making a summary text file.

Hi guys,
I hope you are well and can help.

I have a text file called "sorted_a.txt".
The format of this file is as follows:

--------------------------------------------------------------------------------------------------- sorted_a.txt
abalone -- this is the definition of abalone;
adversary -- this is the defintion;
aeroplane -- this is another meaning;
at the park -- this is at the park;

---------------------------------------------------------------------------------------------------

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

Examine the contents of soreted_a.txt, and treat each block of word or words before the "--" is treated as a single "chunk" per line.
Each of these chunks is copied to a new file called "summary_sorted_a.txt"
Each chunk in this new file is separated from each other by a comma.
The last chunk of the new file will be ended by a semicolon.

An example of its output using the above sorted_a.txt file would be:

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


Any help greatly appreciated.
SOLUTION
Avatar of Surrano
Surrano
Flag of Hungary image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of NVIT
NVIT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
... and the good news is that GNU tools like cat and awk are available for windows as well, both in native and unix-like flavours.
Avatar of Simon336697

ASKER

Guys thanks so much again. That works great. Thank you .