Question: Hello friend. I use Bash-Linux I have an in_file with the structure in the first photo (and it continuous with the same structure for multiple

Hello friend. I use Bash-Linux I have an in_file with the structureHello friend.

I use Bash-Linux

I have an in_file with the structure in the first photo (and it continuous with the same structure for multiple date). Now in an output file I want to the following output (second image) and when the year change (to 2018) I should put dividing line as it seems below

in the first photo (and it continuous with the same structure for

multiple date). Now in an output file I want to the following

Now, to create the list I did:

echo "YYYY MM DD hh:mm:ss.ss lat_N lon_E Depth(km) Mw Region" >> $outputfile

awk '/^EVENT/ {matrx1[NR+2]} ;NR in matrx1 {printf "%10s %10s %7.4f %7.4f %5s", $1,$2,$5,$6,$9};/^EVENT/{matrx2[NR+6]}; NR in matrx2 {printf "%6.1f",$2}; /^EVENT/ {printf "%10s %6s", $3,$4}' $in_file | sed 's/\// /g' >> $outputfile

But , because The REGION is first at the infile (/^EVENT/ {printf "%10s %6s", $3,$4}), , it prints it first of all of them. I want to print them in the order I wrote it and then how to I print the divided line everytime the year change.

And also, the header part isn't working. I thought:

header1=''Seismological stations'

awk 'NR>FNR&&FNR>=(NR-FNR*2) {printf "%b ", $header1}' > $outputfile

So sorry for the information bombing but I really need help!

Thank you so so much!

DATA_TYPE BULLETIN IMS1.0:LONG AUTH Event Bulletin EVENT 2017 tpye NW Balkan Region 2018033117:50:39.735.08324.73010.3.1 Crete, Greece

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!