EDIFACT宏(可读消息结构)
我在 EDI 领域工作,希望获得有关 EDIFACT 宏的帮助,以使 EDIFACT 文件更具可读性。
该消息如下所示:
data'data'data'data'
我想让宏将结构转换为:
data'
data'
data'
data'
请让我知道如何执行此操作。 提前致谢!
BR 乔纳斯
I´m working within the EDI area and would like some help with a EDIFACT macro to make the EDIFACT files more readable.
The message looks like this:
data'data'data'data'
I would like to have the macro converting the structure to:
data'
data'
data'
data'
Pls let me know how to do this.
Thanks in advance!
BR
Jonas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您只想以更易读的格式查看文件,请尝试下载 Softshare EDI 记事本。它是一个相当不错的工具,专门用于此目的,它支持 X12、EDIFACT 和 TRADACOMS 标准,而且是免费的。
If you merely want to view the files in a more readable format, try downloading the Softshare EDI Notepad. It's a fairly good tool just for that purpose, it supports X12, EDIFACT and TRADACOMS standards, and it's free.
在 VIM 中替换(假设正在使用 UNOA 字符集的标准 EDIFACT 分隔符/转义字符):
分解正则表达式:
\([^?]'\)
- 搜索出现在除?
(标准转义字符)之外的任何字符之后的'
并捕获这些两个字符作为第一个原子。这是每个段的最后两个字符。\(.\)
- 捕获段终止符后面的任何单个字符(即,如果段终止符已经位于行末尾,则不匹配)然后用段终止符和下一个段的开头之间的新行。
否则你可能会得到这样的结果:
而不是这样:
Replacing in VIM (assuming that the standard EDIFACT separators/escape characters for UNOA character set are in use):
Breaking down the regex:
\([^?]'\)
- search for'
which occurs after any character except?
(the standard escape character) and capture these two characters as the first atom. These are the last two characters of each segment.\(.\)
- Capture any single character following the segment terminator (ie. don't match if the segment terminator is already on the end of a line)Then replace all matches on this line with a new line between the segment terminator and the beginning of the next segment.
Otherwise you could end up with this:
instead of this:
这是您要找的吗?
Is this what you are looking for?