0

In 4 th column I have values like (harsha-eircom, sarath-eircom) in printing I have to skip"-eircom".and if any field or value is null print "null". I tried like this, but not getting exact output, can u help me out.

a=$(awk -f "\"*, \"*" '{print$4}' sample. csv) 
echo "$a"
b=$(cut  -d '-' -f1 <<< "$a")
#echo "$b"
for a in $b
do
If [-z "$b"]
then
echo "value is null"
else
echo "$a"
fi
done
oguz ismail
  • 1
  • 16
  • 47
  • 69
  • 1
    Sample input would be in order. – Armali Apr 15 '20 at 08:53
  • 2
    Does this answer your question? [using bash (sed/awk) to extract rows AND columns in CSV files?](https://stackoverflow.com/questions/14492590/using-bash-sed-awk-to-extract-rows-and-columns-in-csv-files) – Kostja Apr 15 '20 at 10:18

0 Answers0