affordableCebu
Classified Ads
Tips & Guides
Login
Register
Search
Ask Question
Post a Free Ad
Home
»
Questions
»
Computers
[
Ask a new question
]
vim , reformat text for programming
vim , reformat text for programming
I've a big file with lines that look like
Asked by:
Guest
| Views: 295
Total answers/comments:
2
Comments display order:
By default
New comments first
Old comments first
Guest
[
Entry
]
"The basic conversion is,
sed 's|^\([0-9]\)\(.*\)|{\1,""\2""}|g' file.txt > file2.txt
in vim,
:%s/\([0-9] \(.*\)/{\1,""\2""}/g
This will cover lines starting with the format,
N text on the line...
Where N is a single digit number.
Can be extended further for other forms."
Guest
[
Entry
]
"Does this vim command do what you want ?
%s/^\(.\)\ \(.*\)$/{\1,\ ""\2""},/g"