0

我有一个 word 文档,我只想选择以整数开头的行。我有 cygwin 并想使用 awk 命令来选择整行...

我正在使用的命令是 awk /n/ document1,但它为我用“n”字母拉线。

例如:

129 CalledVPNTop-
GroupNumber
Char[15] Indicates the top group number of the called party.
Value range: numerals within 0-9
Can be null
130 CalledVPNGrou
pNumber
Char[10] Indicates the group number of the called party.
Value range: numerals within 0-9
Can be null
131 CalledVPNShor
tNumber
Char[10] Indicates the short number of the called party
Value range: numerals within 0-9
Can be null
132 CallingNetwork
Type
Char[10] Reserved.
Can be null
133 CalledNetwork-
Type
Char[10] Reserved.
Can be null
134 GroupCallType Char[10] Indicates the call type when the charged subscriber
is a VPN user.
The options are as follows:
l 0: On-net call
l 1: Off-net call
l Other: to be extended

我想提取以 129、130、131 等整数开头的字符,以及之后的 11 个字符。任何帮助将不胜感激...

4

2 回答 2

1

对于文本文件,我会使用awk '/^[:digit:]*/ {print $0}' document.txt.

于 2012-11-16T10:34:40.843 回答
1
awk '/^[0-9]+/{print substr($0,length($1),11)}' your_file
于 2012-11-16T10:56:29.467 回答