View Single Post
BluesLee's Avatar
Posts: 411 | Thanked: 1,105 times | Joined on Jan 2010 @ Europe
#8
Originally Posted by taixzo View Post
What exactly does this line do:
Code:
vim -c ':/description' -c ':.-1' -c ":1,. d" -c ":.+1" -c ":.,$ d" -c ":wq!" ${file_prefix}.html
I'm trying to implement this in Python.
Essentially, it searches for the first occurence of a line containing "description" in ${file_prefix}.html and saves the file. Replacing it by
Code:
grep "description" ${file_prefix}.html | head -1
makes the usage of vi(m) redundant and it should be also much faster. For details see the answer of figaro.

Last edited by BluesLee; 2012-09-23 at 06:14.
 

The Following 4 Users Say Thank You to BluesLee For This Useful Post: