Using awk to do arithmetic operation

Hi,

I've this following text file

FileVersion      = 1.03
Filetype         = meteo_on_curvilinear_grid
TIME = 0 hours since 2016-10-03 12:00:00 +00:00
 -6.855  -6.828  -6.801  -6.774  -6.747  -6.719  -6.691  -6.663  -6.634  -6.606  -6.577  -6.548  -6.519  -6.489  
 TIME = 0 hours since 2016-10-03 12:00:00 +00:00
 -6.855  -6.828  -6.801  -6.774  -6.747  -6.719  -6.691  -6.663  -6.634  -6.606  -6.577  -6.548  -6.519  -6.489  
 TIME = 0 hours since 2016-10-03 12:00:00 +00:00
 -6.855  -6.828  -6.801  -6.774  -6.747  -6.719  -6.691  -6.663  -6.634  -6.606  -6.577  -6.548  -6.519  -6.489

and I'm trying to create like this:

FileVersion      = 1.03
Filetype         = meteo_on_curvilinear_grid
TIME = 0 hours since 2016-10-03 12:00:00 +00:00
 -6.855  -6.828  -6.801  -6.774  -6.747  -6.719  -6.691  -6.663  -6.634  -6.606  -6.577  -6.548  -6.519  -6.489  
 TIME = 6 hours since 2016-10-03 12:00:00 +00:00
 -6.855  -6.828  -6.801  -6.774  -6.747  -6.719  -6.691  -6.663  -6.634  -6.606  -6.577  -6.548  -6.519  -6.489  
 TIME = 12 hours since 2016-10-03 12:00:00 +00:00
 -6.855  -6.828  -6.801  -6.774  -6.747  -6.719  -6.691  -6.663  -6.634  -6.606  -6.577  -6.548  -6.519  -6.489

So, mainly want to change the TIME by 6 hourly intervals. Can anyone kindly help me with this?

Thanks.

Is this a homework assignment? Homework and coursework questions can only be posted in the Homework & Coursework forum under special homework rules.

If this is not homework, please explain the company you work for and the nature of the problem you are working on. And:

  1. tell us what operating system you're using
  2. what shell you're using, and
  3. show us what you have tried to solve this problem on your own.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

1 Like