![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| removing comments from file | skully | Shell Programming and Scripting | 9 | 06-08-2008 06:44 PM |
| How to put the comments to 50 lines, using vi editor? | artikulkarni | UNIX for Dummies Questions & Answers | 3 | 02-08-2008 01:57 AM |
| need help appending lines/combining lines within a file... | mr_manny | Shell Programming and Scripting | 2 | 01-06-2006 03:45 PM |
| Use "read" with a text file with comments | mbarberis | Shell Programming and Scripting | 3 | 03-29-2005 11:24 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Add Comments to the specifi lines i na file
I have a requirement like below.I need to Comment some lines in a file.
File contains following information. { attribute1 attribute2 atrribute3 attribute4 attribute5 attribute6 attribute7 } I have a requirement like some times i need to comment lines 3 to before '}' and some times from 5 to before '}' Out Put for scenario1 { attribute1 attribute2 //atrribute3 //attribute4 //attribute5 //attribute6 //attribute7 } Out Put for schenario2 { attribute1 attribute2 atrribute3 attribute4 //attribute5 //attribute6 //attribute7 } Can any one please help me how can i acheive this. Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
sed -e '/attribute3/,/attribute7/ s/.*/\/\/&/ ' file |
|||
| Google The UNIX and Linux Forums |