![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Removing the first and last lines in a file | naveendronavall | Shell Programming and Scripting | 2 | 12-29-2007 10:22 PM |
| Removing a specific word from a created list | erest8 | UNIX for Dummies Questions & Answers | 5 | 10-14-2007 02:11 AM |
| Removing parts of a specific field | kieranh | Shell Programming and Scripting | 9 | 09-28-2007 09:52 AM |
| Removing lines from a file | computersaysno | UNIX for Dummies Questions & Answers | 6 | 11-14-2006 03:50 PM |
| Removing lines from a file | PradeepRed | Shell Programming and Scripting | 4 | 12-17-2005 03:34 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Removing specific lines
Hi
I have a .conf file having many location tags like <Location /main> AuthName main AuthUserFile /ppt/gaea/passwd_main Require user admin </Location> ...... ... <Location /wonder> AuthName gaea AuthUserFile /ppt/gaea/passwd_gaea Require user admin </Location> . now I want to remove a tag having attribute "main" through shell script .Please help me how do i remove this Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
With awk you can do something like:
Code:
awk '/^<Location \/main>/{f=1;next}
f && /^<Location /{f=0}
!f' file
|
|
#3
|
|||
|
|||
|
Thank u franklin .its working
Last edited by catgovind; 04-29-2008 at 11:10 PM. |
|
#4
|
|||
|
|||
|
Redirect the output to a temporary file and replace the original file with it.
Regards |
|||
| Google The UNIX and Linux Forums |