How to truncate STDIN line length?

前端 未结 9 1845
醉酒成梦
醉酒成梦 2021-01-05 07:15

I\'ve been parsing through some log files and I\'ve found that some of the lines are too long to display on one line so Terminal.app kindly wraps them onto the next line. Ho

9条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-05 07:53

    A Korn shell solution (truncating to 70 chars - easy to parameterize though):

    typeset -L70 line
    while read line
    do
      print $line
    done
    

提交回复
热议问题