Dear experts,
I need bit help in formatting ..
I have csv file file , i will read that file by passing one column value as input parameter and display header row and corresponding row for that parameter.
I have shell script like this:
#!/bin/bash
#key_word_I_am_looking_for=$1
#awk -F: -v keyword="$1" '$1 == keyword {$1=$1; print}' Book1.csv
#my_variable=`cat Book1.csv | awk -F: -v keyword="$key_word_I_am_looking_for" '( $1 == keyword )' END{print "$@" }'`
#echo "$my_variable"
SERVICE=$1
head -n 1 /opt/scripts/devv/book7.csv > message.out
awk '{gsub(/\,/," ");print;}' message.out
grep -i $1 /opt/scripts/devv/book7.csv > message1.out
awk '{gsub(/\,/," ");print;}' message1.out
I tried to use tab for header line..used same tab as delimiter for second line but second values not aligned with first line...can some one suggest please..
Current out put as below:
SERVICE NAME TEAM NAME CI OWNER SECONDARY CONTACT PAYCHECK NAME DEVV ADEINT ENV DEV ENV STAGE ENV PROD ENV PROD
checkout SARD opalan Jef May abcdef Yes Yes Yes Yes Yes Yes