Avatar of MarkLoveExEx
MarkLoveExEx
 asked on

sort this file using out-of-the-box Redhat Linux tools

Dear script writers,

Is there a way to sort the data in the attached file (using a script) where the oldest data is on the top, and the latest data is at the bottom? It would have to processed, keeping the "blocks" of data together and using the date info from the ".ER" lines.

A ".ER" line is the begining of a block of data. The spacing and format of the data can't be changed. Just need to blocks sorted. The date information is in the "ER" lines, as as follows:
.ER LAWV2    0224 E DC201602241659/DH19/HGIFF/DIH6
YYYYMMDDhhmm

Tools must be out of the box Redhad Linux. I know I have python, awk, shell script stuff. Whatever works the best...

Thanks for your help!
testfile.txt
Scripting LanguagesLinuxShell Scripting

Avatar of undefined
Last Comment
MarkLoveExEx

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Maciej S

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
MarkLoveExEx

ASKER
Excellent job. Thank you so much!  One thing I forgot to mention is that sometimes there are 5 lines of data, and sometimes there are 6 lines. But it looks like you took that into account, and the script works perfectly. Thanks again!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck