I got one requirement to process text file and collect two fields and convert those fields from column to row , finally convert to spread sheet. I tried to follow below URL An efficient way to transpose a file in Bash. Unfortunately i was not able understand code properly.
Here is my text file
cat oralinux1_20191015.log
date collected ||11-11-2019 03:58:54 GMT ||
host name || oralinux1 ||
kernel version || 2.6.32-754.23.1.el6 || Good
kernel architecture || x86_64 || Good
hardware type || virtual || Good
No.of CPU || 4 || Good
Installed Mem || 16 Good || Good
/u01 file pct free || 28 % || Good
my Requirement is
i need to pick 1st column and last column from the log and convert row as columns as csv/spread sheet
Date collected,host_name,kernal version , kernel architecture , hardware type , No.of.cpu, installed_mem,
Good, good, good, good, good
So technically 1st filed of the file will become 1st row and corresponding value in last column shoud be second row
Kindly help me on this issue. To be honest, I am not a extreme shell script developer and started my career recently. Kindly help me on this. I am ok with shell script or python code, since i have started learning.
Thank you,
Durga