---------- Post updated at 07:11 PM ---------- Previous update was at 06:54 PM ----------
One more question :
Suppose I have a file file1.txt with the below contents :
a b c e
f g h i j
m y t
EFFECTIVE_TIME 1373938000
l r t o
The second field on Line number 4 is time ( this could be on any row but will always have EFFECTIVE_TIME as first column) which I want to convert into human readable time. So how can we convert this into real time.
awk '/EFFECTIVE_TIME/ #### Searching for string EFFECTIVE_TIME
{ printf "%s %s\n", $1, strftime("%c",$NF); #### if above condition is TRUE and a line has string EFFECTIVE_TIME then print the first column and chage last column to actual human readbable time.
next} #### Now leave all coming statments/actions by calling next here
1 #### awk works on method of conditions and then perform actions, by 1 we are making condition as TRUE and not mentioning the action here so awk is performing the default action which is print so it will print al lthe lines
' Input_file #### mentioning Input_file here.