Hi,
I am writing a code to basically pivot the data.
awk -v var1="" -v var2="" -v var3="" -v var4="" -v var5="" -v Disp=0\
'BEGIN {FS=":"; OFS="|";}\
/^Pattern1/ {var1=$2;Disp=0;} \
/^Pattern2/ {var2=$2;} \
/^Pattern3/ {var3=$2;} \
/^Pattern4/ {var4=$2;} \
/^Pattern5/ {var5=$2;Disp=1;} \
{
print "$var1,$var2,$var3,$var4,$var5"
}' "InputFile" "OutputFile"
But I am getting the below issues
a) $2 is picking the entire record
b) print statement is displaying result as below
c) How can we remove leading and trailing spaces of Value1... Value5