I am looping million log files, arranged in fixed format: one line with 5 columns:
0 0.258517 0.20418 0.1592 0.258123
I need to take the number from the 2nd column and save it to the separate log together with the name of the log file, keeping the following format (so the final log should contain N lines for each of the LOG)
name_of_file1: 0.258517
...
name_of_fileN: nnnnnnn
Here the possible sollution only lacking some function (AWK??) taking the 2nd column value:
# loop the log files and take the 2nd column to separate log
for log in "${output}"/*.log ;cd dofoler_with_all_logs
# extract name of the log
log_name=$(basename "$log" .log)
# do something to extract the number and then add the line with $log_name to >> final_summary.log
done awk '-F, *' '{ printf("%s| %s\n", FILENAME,$2) }' *.log >> final_summary.log
Here the problem in my AWK function which does not recognize the format of the second column of my log file.