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

前端 未结 6 1441
北荒
北荒 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:16

    don't have to use grep either

    an example:

    sed -n '/searchwords/{s/^\(.\{12\}\).*/\1/g;p}' file
    

提交回复
热议问题