Before:
Quote:
du -sh us1234
du -sh us5678
du -sh us9abc
du -sh usefgh
du -sh usijgl
du -sh usmnop
du -sh usqrst
|
Command:
Code:
:1,$s/$/ >> \/tmp\/output\.txt/
After:
Quote:
du -sh us1234 >> /tmp/output.txt
du -sh us5678 >> /tmp/output.txt
du -sh us9abc >> /tmp/output.txt
du -sh usefgh >> /tmp/output.txt
du -sh usijgl >> /tmp/output.txt
du -sh usmnop >> /tmp/output.txt
du -sh usqrst >> /tmp/output.txt
|
Let's break it down:
1. <Esc>, : Go into command mode
2. 1,$ Execute this command on every line between 1 and End of file ("$")
3. s/$/ >> \/tmp\/output\.txt/ The command is "substitute" ("s/X/Y/")
4. /$/ >> \/tmp\/output\.txt/ This means:
a) substitute "end of line" ($)
b) for " >> /tmp/output.txt"
c) Escape the "/" and "." metacharacter (using "\")
'Hope that helps .. PSM