Computing.Net > Forums > Unix > awk-script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

awk-script

Reply to Message Icon

Name: thomas
Date: October 30, 2002 at 00:49:18 Pacific
OS: suse
CPU/Ram: 512
Comment:

ich besitze eine text-file:

[hallo1]
test
bla
[hallo2]
test1
bla1

wie kann ich mit hilfe von awk den text ab "[hallo1]
test
bla
löschen. einfach nur das löschen.
aber nur bis [hallo2]



Sponsored Link
Ads by Google

Response Number 1
Name: James Boothe
Date: October 30, 2002 at 08:04:36 Pacific
Reply:

Entschuldigen Sie bitte dieses Deutsche. Es lief Englisch zum deutschen Übersetzer durch.

Dieses überbrückt alle Linien, die einer Linie hallo1 folgen, bis sie zu einer Linie hallo2 kommt.

Die Linien werden überbrückt, selbst wenn es keine Linie hallo2 gibt.

Wenn Sie auch die Linien hallo1 und hallo2 überbrücken möchten, schalten Sie das erste und letzt "if" Aussagen.

awk '{\
if (substr($0,1,8)=="[hallo2]")
uberbruckung=0
if (uberbruckung==0)
print
if (substr($0,1,8)=="[hallo1]")
uberbruckung=1
}' filein > fileout


0
Reply to Message Icon

Related Posts

See More


What's different btw unix... log file script



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: awk-script

tweaking William's awk script www.computing.net/answers/unix/tweaking-williams-awk-script/5174.html

awk script help www.computing.net/answers/unix/awk-script-help/5596.html

awk call other awk script? www.computing.net/answers/unix/awk-call-other-awk-script/5574.html