如何从windows word文件中的字符串中唤醒特定字符

时间:2012-11-16 10:29:21

标签: awk cygwin

我有一个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个字符。任何帮助将受到高度赞赏...

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

awk '/^[0-9]+/{print substr($0,length($1),11)}' your_file