Results 1 to 3 of 3
I was wondering if there is a single line sed command to delete lines of text between 2 characters. For example, between /* and */ in a java/c source code. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-01-2005 #1Just Joined!
- Join Date
- Apr 2005
- Posts
- 3
Sed command to delete between 2 points
I was wondering if there is a single line sed command to delete lines of text between 2 characters. For example, between /* and */ in a java/c source code. I try sed '/[/*]/,/[*/]/d' but it only deletes odd parts of the code. I thought that the above meant delete between */ and */ but it doesnt work. Any advice or help would be appreciated. Thanks
- 05-01-2005 #2Linux Engineer
- Join Date
- Sep 2003
- Location
- Knoxhell, TN
- Posts
- 1,078
try this:
the regex you were using meant 'delete lines between any line containing a '/' or a '*' and lines containing a '*' or '/''Code:sed -e '/\/\*/,/\*\//d'
Their code will be beautiful, even if their desks are buried in 3 feet of crap. - esr
- 05-01-2005 #3Just Joined!
- Join Date
- Apr 2005
- Posts
- 3
Thank you very much. Now I understand what I was doing wrong.


Reply With Quote
