python - Sed to remove everything after "." in file using * command? -
i have following data.txt:
95 flour. 47 water.s etc..
i need remove after period . in file yield this:
95 flour 47 water etc..
i have tried using these sed command without success, yield blank document:
sed "s/'.*//" data.txt > cleaned.txt sed 's/\.*//' data.txt > cleaned.txt
either escape .
backslash literal .
, or use brackets define character class:
sed 's/\..*$//' data.txt > cleaned.txt sed 's/[.].*$//' data.txt > cleaned.txt
you tried 's/\.*//'
, "zero or more literal dots", different "literal dot followed 0 or more of anything", i.e. 's/\..*//'
. added $
measure.
Comments
Post a Comment