Sed to remove everything after “.” in file using * command?

前端 未结 3 451
我寻月下人不归
我寻月下人不归 2021-02-05 15:10

I have the following data.txt:

 95 flour.
 47 water.s
 etc..

I need to remove everything after the period (.) in the file to yield s

3条回答
  •  半阙折子戏
    2021-02-05 15:49

    This is the simplest:

    sed "s/\..*//"
    

    And this is, I think, one of the best ways of doing it (better than pure bash or Python).

提交回复
热议问题