I am trying to remove the entire decimal part of the numbers of a csv file, with sed. All I can do is truncate all the decimals (that are .0) from the whole columns of the file and I don't know how to do it only in the sixth column.
Input:
PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked
343,No,2,"Collander, Mr. Erik Gustaf",male,28.0,0,0,248740,13.0,,S
76,No,3,"Moen, Mr. Sigurd Hansen",male,25.0,0,0,348123,7.65,F G73,S
Expected Output:
PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked
343,No,2,"Collander, Mr. Erik Gustaf",male,28,0,0,248740,13.0,,S
76,No,3,"Moen, Mr. Sigurd Hansen",male,25,0,0,348123,7.65,F G73,S
My try:
sed -r ‘s/\.0//g’ file.csv
7.65
to7
?g
at the end is to substitute ALL of the coincidences of the file, which I want but only from column "Age".mlr --csv put '$Age = int($Age)' Input.csv