小编jag*_*ags的帖子

从一行中提取没有定界符的固定宽度记录

我需要从包含一行很长文本的单个文件中提取文本字符串,没有分隔符。使用下面的示例行,这些是以下已知事实:

???????A1XXXXXXXXXX???????B1XXXX???????A1XXXXXXXXXX???????C1XXXXXXX

1.  It contains 38 fixed width record types 
2.  The record marker is a 7 alphanumeric character followed by, for example, ‘A1’.
3.  Each record type has varying widths, for example, A1 record type will have 10 characters following it, if B1 then 4, and if C1 then 7.
4.  The record types aren’t clumped together and can be in any order. As in the example, its A1,B1,A1,C1
5.  The example above has 4 records and each record …
Run Code Online (Sandbox Code Playgroud)

sed awk text-processing

8
推荐指数
2
解决办法
4240
查看次数

标签 统计

awk ×1

sed ×1

text-processing ×1