![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Add Comments to the specifi lines i na file | ukatru | UNIX for Advanced & Expert Users | 1 | 09-21-2008 09:39 AM |
| removing comments from file | skully | Shell Programming and Scripting | 9 | 06-08-2008 10:44 PM |
| skip reading certain lines in a file | paulsew | UNIX for Dummies Questions & Answers | 5 | 03-26-2007 04:07 AM |
| Skip new line | pmpx | Shell Programming and Scripting | 2 | 10-13-2005 01:43 AM |
| FreeBSD skip UserConfig... | Enoch Chan | BSD | 2 | 09-03-2003 06:48 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
AWK to skip comments in XML file
Hello,
I'm trying to make a shell script to skip comments from an XML file, but with the code below only deletes comments that are in one line. Can you tell me what can be added here? Code:
nawk '
{
if($0 !~/<!--/) { a=0 }
if($0 ~/<!--/ && $0 ~/-->/) {a=1}
if($0 ~/<!--/) {a=1}
if (a == 1) {next}
if ($0 ~/-->/) {next}
if (a == 0) {print $a}
}
' ff
Code:
this is a file <!-- lalala lalaa 1223 zzz --> begin here important text here <!-- 34543645 dsgs 1223 --> important text here2 Code:
this is a file zzz begin here important text here important text here2 Thanks |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|