Не могли бы вы попробовать следующее.
awk '
BEGIN{
print "S.No Date Time file_list Token proxy_name"
}
!/file_list|fileList|"method":"registerSender"/{ next }
match($0,/"file_list":\["[^"]*|"fileList":\["[^"]*/){
fileVal=substr($0,RSTART,RLENGTH)
gsub(/"file_list":\["|"fileList":\["/,"",fileVal)
}
match($0,/"Token":"[^"]*/){
token_Val=substr($0,RSTART+9,RLENGTH-9)
}
match($0,/"proxy_name":"[^"]*|"origin":"[^"]*/){
proxyName=substr($0,RSTART,RLENGTH)
gsub(/"proxy_name":"|"origin":"/,"",proxyName)
}
{
split($1,arrayDate,"-")
print ++count,arrayDate[1]"-"arrayDate[2]"-"arrayDate[3],$2,fileVal,token_Val,proxyName
fileVal=token_Val=proxyName=""
}
' Input_file | column -t
Объяснение: Добавлено подробное объяснение.
awk ' ##Starting awk program from here.
BEGIN{ ##Starting BEGIN section from here.
print "S.No Date Time file_list Token proxy_name" ##Printing headers here.
}
!/file_list|fileList|"method":"registerSender"/{ next } ##If a line not having mentioned strings by OP simply move next then.
match($0,/"file_list":\["[^"]*|"fileList":\["[^"]*/){ ##Using match function to match file_list":\[" till next " to get its value.
fileVal=substr($0,RSTART,RLENGTH) ##saving matched value into variable fileVal here.
gsub(/"file_list":\["|"fileList":\["/,"",fileVal) ##substituting "file_list":\[" OR "fileList":\[" with NULL.
}
match($0,/"Token":"[^"]*/){ ##Using match function to match "Token":"[ till next ".
token_Val=substr($0,RSTART+9,RLENGTH-9) ##saving matched value into variable tolen_Val here.
}
match($0,/"proxy_name":"[^"]*|"origin":"[^"]*/){ ##using proxy_name":" till " OR origin.
proxyName=substr($0,RSTART,RLENGTH) ##saving matched value into variable proxyName here.
gsub(/"proxy_name":"|"origin":"/,"",proxyName) ##substituting "proxy_name":" OR "origin":"with NULL.
}
{
split($1,arrayDate,"-") ##Splitting 1st column into array with delimiter space here.
print ++count,arrayDate[1]"-"arrayDate[2]"-"arrayDate[3],$2,fileVal,token_Val,proxyName ##Printing all the values to get OP result here.
fileVal=token_Val=proxyName="" ##Nullifying variables here.
}
' Input_file | column -t ##Mentioning Input_file name here and passing its output to column command.