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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -