Open Source Desktop Environment : GnuAwk

HomePage :: Categories :: PageIndex :: RecentChanges


Search this site: OSDE.INFO is produced by "osde8info" :

Revision [783]

Most recent edit made on 2006-11-17 09:33:50 by WikkaWiki (unregistered user)

Additions:
replace fsf with free software foundation
break fields into lines
print fields 2 4 6 on separate lines and separate with a blank line
$ awk '{print $2 ; print $4 ; print $6 ; print "" }'




Revision [782]

Edited on 2006-11-17 05:49:15 by WikkaWiki (unregistered user)

Additions:
http://docs.freebsd.org/info/gawk/gawk.info.String_Functions.html
gsub
$ awk '{ gsub(/fsf/, "free software foundation", $0); print $0 }'




Revision [781]

Edited on 2006-11-17 05:45:39 by WikkaWiki (unregistered user)

Additions:

n=split($4,params,"&")
xips=params[n]

n=split(xips,ips,"=")
client=ips[n]

n=split(client,ip,"+")
if (n) {client=ip[n]}

# gsub($3,client,$8)
# gsub($3,client,$13)

print $1,$2,client,$4,$5,$6


Deletions:

n=split($4,params,"&")
xips=params[n]
n=split(xips,ips,"=")
client=ips[n]
n=split(client,ip,"+")
if (n) {client=ip[n]}
print $1,$2,client,$4,$5,$6




Revision [778]

Edited on 2006-11-16 16:51:12 by WikkaWiki (unregistered user)

Additions:

n=split($4,params,"&")
xips=params[n]
n=split(xips,ips,"=")
client=ips[n]
n=split(client,ip,"+")
if (n) {client=ip[n]}
print $1,$2,client,$4,$5,$6
IN
x y z a=1&b=2&c=6 u v w
x y z a=1&b=2&c=3+4+5 u v w
OUT
x y 6 a=1&b=2&c=6 u v
x y 5 a=1&b=2&c=3+4+5 u v


Deletions:

n=split($8,params,"&")
xips = params[n]
n=split(xips,ips,"=")
client=ips[n]
pos = match(client,/\+/)
if ( pos != 0 ) {
n=split(client,ip,"+")
client=ip[n]
}
print $1,$2,client,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15




Revision [777]

Edited on 2006-11-16 11:19:50 by WikkaWiki (unregistered user)

Additions:

print $1,$2,client,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15


Deletions:

print $1,$2,client,$4 #,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15




Revision [776]

Edited on 2006-11-16 11:19:01 by WikkaWiki (unregistered user)

Additions:

client=ips[n]
pos = match(client,/\+/)
if ( pos != 0 ) {
n=split(client,ip,"+")
client=ip[n]
}
print $1,$2,client,$4 #,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15


Deletions:
$ awk -f script aaa.log | head
print $1,$3,ips[2]




Revision [775]

Edited on 2006-11-16 11:02:46 by WikkaWiki (unregistered user)

Additions:
awk script
$ awk -f script aaa.log | head
/^#/ {print}
!/^#/ {
n=split($8,params,"&")
xips = params[n]
n=split(xips,ips,"=")
print $1,$3,ips[2]
}




Revision [774]

Edited on 2006-11-16 10:29:57 by WikkaWiki (unregistered user)

Additions:
Use awk to passthru comments, split uri (8th field) and print value of 21st parameter
10.10.10.10
10.10.10.10


Deletions:
87.103.41.223
87.103.41.223
87.103.41.223




Revision [773]

Edited on 2006-11-16 10:27:28 by WikkaWiki (unregistered user)

Additions:
split a split
$ awk '/^#/ {print} !/^#/ { split($8,url,"&") ; split(url[21],ip,"=") ; print ip[2] }' aaa.log | head
#Remark: DCS-p
#Software: WebTrends SmartSource Data Collector V8.0
#Version: 1.0
#Date: 2006-11-14 09:33:48
#Fields: date time c-ip cs-username cs-host cs-method cs-uri-stem cs-uri-query sc-status sc-bytes cs-version cs(User-Agent) cs(Cookie) cs(Referer) dcs-id
87.103.41.223
87.103.41.223
87.103.41.223




Revision [772]

Edited on 2006-11-16 10:20:15 by WikkaWiki (unregistered user)

Additions:
passthrough
split
Use awk to pass thru # comment lines and print first middle part of domain name from 5th field
$ awk '/^#/ {print} !/^#/ { split($5,url,".") ; print $1,$3,url[2] }' aaa.log | head




Revision [771]

Edited on 2006-11-16 10:06:03 by WikkaWiki (unregistered user)

Additions:
Use awk to pass thru # comment lines and print first three (space delimited) fields of a file
$ awk '/^#/ {print} !/^#/ {print $1,$2,$3}' aaa.log | head




Revision [767]

Edited on 2006-11-16 08:57:53 by WikkaWiki (unregistered user)

Additions:

GNU awk



Deletions:

GNU awk





Revision [765]

The oldest known version of this page was edited on 2006-11-16 08:55:56 by WikkaWiki (unregistered user)

GNU awk


reverse
Use awk to print first three (space delimited) fields of a file in reverse order

$ awk '{print $3,$2,$1}' aaa.log
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.1097 seconds