![]() |
|
|
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 |
| Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" | iBot | UNIX and Linux RSS News | 0 | 01-04-2008 03:00 PM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| grep to find content in between curly braces, "{" and "}," | keshav_rk | Shell Programming and Scripting | 4 | 08-09-2007 11:14 PM |
| how could i make a program mixed with many "|", "<" and ">" | strugglingman | High Level Programming | 2 | 04-29-2006 09:11 AM |
| No utpmx entry: you must exec "login" from lowest level "shell" | peterpan | UNIX for Dummies Questions & Answers | 0 | 01-18-2006 04:15 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Yesteray I post a topic talking about log processing, thanks aigles for giving me the script, the first time I heard "next" and "gsub" function, so I decided to do some test work, but I failed, and don't know why
The logfile as follow, notice line 2 contains an username *snip* Nov 9 10:12:01 testfirewall root: [ID 702911 local5.info] 0:00:11 accept testfw01-hme0 >hme0 proto: icmp; src: test001.example.net; dst: abc.dst.net; rule: 1; icmp-type: 8; icmp-code: 0; product: VPN-1 & Fire Nov 9 10:12:54 testfirewall root: [ID 702911 local5.info] 0:23:54 accept testfw01-hme0 >hme0 proto: tcp; src: maa.example.net; dst: NYCMNYZRHN0.dst.net; service: cerent_1080; s_port: 1649; rule: 30; user: abc; len: 44; srcname: abc.example.net; product: VPN-1 & FireWall-1 *snip* the request "find16 column doesn't contain 192.1 or 192.2 or deve" AND "there is "user" keyword appears in the log" AND delete all the ";" character in the log my though was like this gawk 'BEGIN {OFS = "\t"} $16!~"192.(1|2)|deve" && $0~"user" {next} gsub(/;/,"") {print $0}' fw.log But the script work incorrectly, and I noticed when I just use the first part of the awk program, gawk 'BEGIN {OFS = "\t"} $16!~"192.(1|2)|deve" && $0~"user"' fw.log there was no problem, every line match the criterion I defined, but when I add " {next} gsub(/;/,"") " seemed awk process the logfile totally different, the output result even did not contain "user", I tried to delete "next", still same. I tried comp.awk.faq, but no information related to "next" function. So please give me some direction what's wrong with my script? and what exactly "next" do in awk. Thank you! |
|
||||
|
Quote:
Quote:
Pardon me if this is a stupid question. ![]() Last edited by fedora; 11-15-2006 at 03:42 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|