与cut
:
$ cut -d' ' -f2- file
PT disconnected
CC1 received TCMTM
CC2 received TCMTM
TFT received TCMTM
FEC received TCMTM
将空格设置为分隔符并从字段 2 打印到最后一个 ( f2-
)。
与awk
:
$ awk '{$1=""}1' file ## leading space :(
PT disconnected
CC1 received TCMTM
CC2 received TCMTM
TFT received TCMTM
FEC received TCMTM
将第一个字段设置为空。
$ awk '{for (i=1;i<=NF; i++) $i=$(i+1); NF=NF-1}1' file
PT disconnected
CC1 received TCMTM
CC2 received TCMTM
TFT received TCMTM
FEC received TCMTM
它将字段编号减一,将每个字段移到前一个字段编号(因此,第一个被删除)。
与sed
:
$ sed 's/^[^ ]* //g' file
PT disconnected
CC1 received TCMTM
CC2 received TCMTM
TFT received TCMTM
FEC received TCMTM
删除从行首到第一个空格的所有内容。
或基于您的sed
:
$ sed "s/^[0-9:.]* //g" file
PT disconnected
CC1 received TCMTM
CC2 received TCMTM
TFT received TCMTM
FEC received TCMTM
删除从行首到第一个空格的所有字符0-9
或:
或。.