Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a file which is encoded by base64:

5byg5bCP5piO
c2FyYWg=
5p2O56OK

I want to decode it line by line:

:%!base64 -d

But I get everything in one line:

张小明sarah李磊

What I want is:

张小明
sarah
李磊

How can I do it?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Another solution is the following, which works nicely for me.

%g/^/.!base64 -d
share|improve this answer
1  
:g/./.!base64 -d –  kev Dec 19 '11 at 7:07
    
vimgolfist? ;-) Yeah, the % is in case of :g redundant. Also the . regexp makes sense - no use to try to decode empty lines. –  Martian Dec 19 '11 at 12:36
:%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.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.