Notepad++ – 交换文本文件中的值的字节顺序

huangapple go评论56阅读模式
英文:

Notepad++ - swap endianess of values in text file

问题

0XC71F2A11 0X46776208 0X448659B3 0X00000000 0X00000000 0XBFC3BAD1
0XC7122457 0X4680A201 0X448659B3 0X00000000 0X00000000 0XBFC3BAD1
0XC7147823 0X46756BD2 0X448659B3 0X00000000 0X00000000 0X3FCE418B
0XC7144C13 0X46814776 0X448659B3 0X00000000 0X00000000 0X3FCE418B

我需要交换每个值的字节顺序,例如 0XC71F2A11 -> 0X112A1FC7

英文:

I have text file filled with hex values, six at each line, like this:

0XC71F2A11 0X46776208 0X448659B3 0X00000000 0X00000000 0XBFC3BAD1
0XC7122457 0X4680A201 0X448659B3 0X00000000 0X00000000 0XBFC3BAD1
0XC7147823 0X46756BD2 0X448659B3 0X00000000 0X00000000 0X3FCE418B
0XC7144C13 0X46814776 0X448659B3 0X00000000 0X00000000 0X3FCE418B

I need to swap endianess of every value, for example 0XC71F2A11 -> 0X112A1FC7

答案1

得分: 1

你可以使用正则表达式的查找和替换功能:

查找:(0X)([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})

替换:\1\5\4\3\2

[A-F0-9] 匹配在 AF09 之间的单个字符。

英文:

You can use the find & replace function with regular expressions:

Find: (0X)([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})([A-F0-9]{2})

Replace: \1\5\4\3\2

Notepad++ – 交换文本文件中的值的字节顺序

[A-F0-9] matches a single character between A and F or between 0 and 9.

huangapple
  • 本文由 发表于 2023年7月13日 18:21:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/76678313.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定