I'm trying to create 3 csv files based on the contract type. The Month_to_month.csv has gotten created but why aren't year 1 and 2 working? Please help!
What I have tried:
%%!
contract_month=0
contract_1year=0
contract_2year=0
for line in $(cat data_v3.csv)
do
IFS=','
read customerID gender PhoneService InternetService StreamingTV Contract TotalCharges Churn <<< $line
if [ "$Contract" = "Month-to-month" ]
then
echo ${line}>>Month_to_month.csv
elif [[ "$Contract" = "One year" ]]
then
echo ${line}>>One_year.csv
elif [ "$Contract" = "Two year" ]
then
echo ${line}>>Two_year.csv
fi
done
cat Two_year.csv
cat One_year.csv
cat Month_to_month.csv
The output it shows is:
['cat: Two_year.csv: No such file or directory',
'cat: One_year.csv: No such file or directory',
'7590-VHVEG,Female,No,DSL,No,Month-to-month,29.85,No',
'3668-QPYBK,Male,Yes,DSL,No,Month-to-month,108.15,Yes',
'6713-OKOMC,Female,No,DSL,No,Month-to-month,301.9,No',
'9763-GRSKD,Male,Yes,DSL,No,Month-to-month,587.45,No',
'4190-MFLUW,Female,Yes,DSL,No,Month-to-month,528.35,Yes',
'8779-QRDMV,Male,No,DSL,No,Month-to-month,39.65,Yes',
'6322-HRPFA,Male,Yes,DSL,No,Month-to-month,2970.3,No',
'6865-JZNKO,Female,Yes,DSL,No,Month-to-month,1530.6,No',
'8665-UTDHZ,Male,No,DSL,No,Month-to-month,30.2,Yes',
'8773-HHUOZ,Female,Yes,DSL,Yes,Month-to-month,1093.1,Yes',
'3413-BMNZE,Male,Yes,DSL,No,Month-to-month,45.25,No',
'4080-IIARD,Female,Yes,DSL,Yes,Month-to-month,981.45,No',
'5948-UJZLF,Male,Yes,DSL,No,Month-to-month,....
the