Sorting a text file

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

I have a text file called "a.txt".
Basically, there is a starting word or words, then a delimiter "--" then a description, ending the line with a semicolon.      
The contents are as follows:

--------------------------------------------------------------------------------------------------- a.txt

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

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

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

Sort a.txt by the first word (or words) before the "--"                        
Create a new file called "sorted_a.txt".
An example of its output using the above a.txt file would be:

--------------------------------------------------------------------------------------------------- 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;



Any help greatly appreciated.
LVL 1
Simon336697Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITCommented:
Open a CMD prompt

sort a.txt > sorted_a.txt
type sorted_a.txt

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Simon336697Author Commented:
Hi NVIT,

Thanks so much for your kind help.
0
NVITCommented:
You're welcome, Simon.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.