title: How to speed up awk command in linux?
body: <p>I am using awk command in linux to convert utc to localtime, but the file size is huge (>30 gb) and it would cost more than an hour.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>awk -F"," '{cmd="date -d \"$(date -d \""$1"\")-4hours\" \"+%Y%m%d_%H\"";cmd | getline datum; close(cmd); print $0 ","datum""}' data.txt
  </code></pre>
  
  <p>How can I speed up this command or is there any simple way to do this conversion in linux?</p>
  
  <pre><code>Here is the sample of input:
  
  utc,id
  2018-03-31 16:00:49.425,4485
  2018-04-1 17:01:19.425,30019
  2018-05-31 18:01:49.425,15427
  2018-08-20 19:01:55.425,17579
  2018-09-2 20:02:31.425,23716
  2018-10-15 21:03:34.425,24772
  
  expected output:
  
  utc,id,localtime
  2018-03-31 16:00:49.425,4485,20180331_12
  2018-04-1 17:01:19.425,30019,20180401_13
  2018-05-31 18:01:49.425,15427,20180531_14
  2018-08-20 19:01:55.425,17579,20180820_15
  2018-09-2 20:02:31.425,23716,20180902_16
  2018-10-15 21:03:34.425,24772,20181015_17
  </code></pre>