Posts

Showing posts from September, 2009

Add new line after some text

Today I face a problem related with editing in css file. I downloaded one css file but when I open it in my fedora 11, I find that all code are written in an single line. Its very difficult to understand that code. First i try to format it manually, but then I decide to find some script or use replace feature of my favourite vi editor. After 5 minute struggle I found the solution, here it is- sample css code:- ================================================ BODY{background-color:#70a5cc;font-family:verdana, arial, helvetica,sans-erif;font-size:10pt;color:#333;margin:0 0 10px}ul{margin-left:25px}dl{margin-top:0;padding-left:1px}dt{margin-top:.5em;color:#009;font-weight:700} ================================================ Note: all are in single line Step 1: open file in vi editor. Step 2: In command mode type: a) :%s/{/{\r /gi explanation:- above line break the line after every '{' tag and give two space in new line. syntax:- :%s/ / /gi ...