Reputation: 646
I have text below:
-rw-r--r-- 1 502 136 2607104 Dec 15 11:05 YUH985335
-rw-r--r-- 1 502 136 2433024 Dec 15 11:06 YUH985336
I want to result become like this
15-Dec-2016_11:05 YUH985335 2607104
15-Dec-2016_11:06 YUH985336 2433024
I have try this code
awk -v year=${year} {print $7"-"$6"-"year"_"$8, $9, $5}
but the result have new line in middle
15-Dec-2016_11:05 YUH985335
2607104
15-Dec-2016_11:06 YUH985336
2433024
how to remove newline at column $9
in awk?
Upvotes: 2
Views: 1187
Reputation: 133458
@Dwi Yanuar: Could you please try following and let me know if this helps.
awk -v year=${year} '{printf("%d-%s-%d_%d %d %d\n",$7,$6,year,$8,$9,$5)}' Input_file
Upvotes: 3