如何用shell获取文本每行的前n个字符

如题所述

第1个回答  2015-02-03
$ cat a.txt
asd5678
xyz9090
qwert890

$ cat a.txt | sed -r 's/(...).*/\1/g'

asd
xyz
qwe
相似回答