我有一个由 base64 编码的文件:
5byg5bCP5piO
c2FyYWg=
5p2O56OK
我想逐行解码:
:%!base64 -d
但我把所有内容都放在一行中:
张小明sarah李磊
我想要的是:
张小明
sarah
李磊
我该怎么做?
答案1
另一个解决方案如下,对我来说效果很好。
%g/^/.!base64 -d
答案2
:%normal !!base64 -d^M
:{range}norm[al][!] {commands} *:normal-range*
Execute Normal mode commands {commands} for each line
in the {range}. Before executing the {commands}, the
cursor is positioned in the first column of the range,
for each line. Otherwise it's the same as the
":normal" command without a range.
{not in Vi}
Not available when |+ex_extra| feature was disabled at
compile time.
还有另一种方法:
sed 's/$/Cg==/' | base64 -d