Wednesday, May 26, 2010

Re: how to insert two lines at the same place in many files

>>
>> I have over 300 files that need the following done to them:
>>
>> at line X insert the following two lines:
>>
>> xxx [foo]
>> xxx ack
>>
>> where [foo] is the fully qualified path the the file with the /'s
>> converted to .'s

I usually keep vim out of such tasks. Why not regular linux commands?-
Something like:
for file in `ls your_files*`; do sed -i "Xa\xxx `dirname foo`\nxxx
ack" $file ; done

BR,
Yosi

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: