Using sed, how do you print the first 'N' characters of a line?

前端 未结 6 1430
北荒
北荒 2020-12-22 20:28

Using sed what is an one liner to print the first n characters? I am doing the following:

grep -G \'defn -test.*\' OctaneFullTest.clj          


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-22 21:08

    colrm x
    

    For example, if you need the first 100 characters:

    cat file |colrm 101 
    

    It's been around for years and is in most linux's and bsd's (freebsd for sure), usually by default. I can't remember ever having to type apt-get install colrm.

提交回复
热议问题