SlideShare a Scribd company logo
1 of 56
awk
awk

•                           ·
    Peter Weinberger   Brian Kernighan



•
awk


• sed             , awk
        .
awk

•
•
•
•
• last
chenggan pts/467   192.168.130.29 Thu Aug 18 15:39 still logged in
chenggan pts/446   192.168.130.29 Thu Aug 18 15:38 still logged in
chenggan pts/414   192.168.130.29 Thu Aug 18 15:33 still logged in
chenggan pts/414   192.168.130.29 Thu Aug 18 15:26 - 15:32 (00:06)
lixinhe pts/413  192.168.130.34 Thu Aug 18 15:25 still logged in
lixinhe pts/521  192.168.130.34 Thu Aug 18 15:09 still logged in
xuzhang pts/509   192.168.129.2 Thu Aug 18 15:03 still logged in
•   ip
• last | awk ‘{printf $1, $3}’
  chenggan 192.168.130.29
  chenggan 192.168.130.29
  chenggan 192.168.130.29
  chenggan 192.168.130.29
  lixinhe 192.168.130.34
  lixinhe 192.168.130.34
  xuzhang 192.168.129.2
awk
•                 ,
    $0,$1,$2...            .

•        Pattern { Actions }
    Action
•        { Actions }

•                      ,
chenggan pts/467    192.168.130.29 Thu Aug 18 15:39 still logged in
$0 = chenggan pts/467    192.168.130.29 Thu Aug 18 15:39 still logged in
$1 = chenggan
$2 = pts/467
$3 = 192.168.130.29
$4 = Thu
$5 = Aug
     Pattern     .               Action
    print $1, $3       $1    $3
awk
• FILENAME
• FS         ,

• NF             ,

• OFS
• FNR
• cat /etc/passwd
beanstalkd:x:107:110:beanstalkd user:/var/lib/beanstalkd:/bin/false
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
privoxy:x:73:73::/etc/privoxy:/sbin/nologin
_tor:x:108:514:Tor user:/var/lib/tor:/bin/false
murongjun:x:518:501::/home/murongjun:/bin/bash
liying:x:519:501::/home/liying:/bin/bash
•
•   ?
•   cat /etc/passwd | awk '{ FS=":"; print $1, $6;}'
    beanstalkd /var/lib/beanstalkd
    postfix /var/spool/postfix
    privoxy /etc/privoxy
    _tor /var/lib/tor
    murongjun /home/murongjun
    liying /home/liying
•    cat /etc/passwd | awk '{ FS=":"; OFS = " || "; print $1, $6;}'

    beanstalkd || /var/lib/beanstalkd
    postfix || /var/spool/postfix
    privoxy || /etc/privoxy
    _tor || /var/lib/tor
    murongjun || /home/murongjun
    liying || /home/liying
•                                       ,
      ,         id,      ,          .
                      cityid.

•         php                   ,
    sql     .

•         php   20     ,awk                 1
107255,"2011-06-17","     ",15201095922,0
663805,"2011-07-18","     ",13521050527,0
346569,"2011-05-31","     ",84920575,84920575
268831,"2011-05-29","   ",13601180538,0
551017,"2011-04-20","     ",84920575,84855168
•   awk -F "," '{ printf "insert into dealrevisit values
    (%s,%s,%s,10,0,UNIX_TIMESTAMP());n", $1, $3,
    $4;}' beijing > insert.sql
insert into dealrevisit value (967898,"   ",13681190863,10,0,UNIX_TIMESTAMP());
insert into dealrevisit value (582907,"   ",13901316805,10,0,UNIX_TIMESTAMP());
insert into dealrevisit value (734974,"   ",15010372631,10,0,UNIX_TIMESTAMP());
insert into dealrevisit value (868768,"     ",18600011579,10,0,UNIX_TIMESTAMP());
•      FS       ,FS   ,
            .

• FS   AWK
Pattern { Action }

• Pattern { Action }   AWK
      .

•                      Pattern,
    Action
Pattern { Action }


• AWK                  Pattern
•   awk ‘BEGIN{Action}; Pattern{Action};Pattern {Action};...; END{Action}’ file
BEGIN AND END

• BEGIN   AND   Pattern

• BEGIN
• END
......
create mode 100644 mis/template/mobileads/list.php
 create mode 100644 model/MobileadsModel.php
 create mode 100644 model/TpBankBranchModel.php
 create mode 100644 model/TpBankInfoModel.php
 create mode 100644 model/TpPaymentLogModel.php
 create mode 100644 sql/110818_moddeallog.sql
<em:version>0.1.3</em:version>
......
•   0.1.3
•   <em:version>...
•   awk '$0 ~ /<em:version>[^<]*</em:version>/ {print $0;}' install.rdf |awk -F
    '>' '{print $2}'|awk -F '<' '{print $1}'
•         $0 ~ /<em:version>[^<]*</em:version>/
      Pattern.

•                 $0    ,              /
    <em:version>[^<]*</em:version>/

•   {print $0;}    Action
•         awk     <em:version>0.1.3</
    em:version>

•         awk >               0.1.3</
    em:version

•         awk <               0.1.3
Pattern { Action }


• AWK
202.106.58.18 - - [15/Aug/2011:23:59:42 +0800] 735802 -
"GET /acl/account/checkurl?url=/mis/deals/default/all/
jining&citySlug=jilin HTTP/1.0" 302 - "http://
www.meituan.com/mis/" ....
221.223.96.234 - - [15/Aug/2011:23:59:58 +0800] 450858 -
"GET /deal/1105.html HTTP/1.0" 200 2132 "http://
www.meituan.com/mis/account/login"
•   apache

•          url         ,                    url
                 url

•                url           mis

•   grep                   ,         grep
• awk ' $9 ~ /mis/ { print $0}' log
• awk   awk B
Pattern { Action }

• AWK        Pattern            >,<

•   awk '$1 + $2 < 100' test
             100                       Pattern
           Action,                  Action

•   AWK Pattern            !~   .
awk


• awk    shell
   ,             awk
3199,   ,     ,187****9445,     BD (       )
3228,   ,   ,136****9587,     BD (     )
2962,   ,     ,136****7116,     BD (       )
2963,   ,     ,137****0897,     BD (       )
5554,   ,     ,186****2154,
4838,   ,     ,134****7617,     BD (       )
4882,   ,   ,139****5562,     BD (     )
•   .
•   php   ,   20   ,awk   1
•   awk 'BEGIN {FS=","} { print $0 >>$2; close($2);}'
    cityuser
•    ,         .
          $2            .

• close
• awk
                   close()
awk
•                   getline      .

• getline   ,
                                     .

•               ,getline             1,
                      0,                  ,
                ,          -1.
• awk 'BEGIN { while("who" | getline) n++;
    print n;}'
•                             .
•   awk 'BEGIN {"date" | getline dtime; print dtime}'

•
•          data                  dtime,
202.106.58.18 - - [17/Aug/2011:23:59:51 +0800] 1042839 - "GET /mis/deals/default/all/ningbo HTTP/1.0" 200 17505 "http://
www.meituan.com/mis/frame/side?city=ningbo" "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0"
"uuid=13ce7442b68505d69df7.1297390972.68.4.1; __utma=1.64891309.1297390974.1313584928.1313594207.499;
__utmz=1.1313594207.499.164.utmcsr=%28none%29|utmccn=UserReferral|utmcmd=im|utmctr=index|utmcct=u313552;
mb=15210890172; ci=135; __utmv=1.|1=city=yuncheng=1,2=user=BD=1; abt=1313544681%7CADF; m=chuan_ye_lony
%40163.com; al=HRPAxN_gimR2EVusR69-AhDTM2t0V-Z7ENMza3RX5nvXmpHDt8V-XQ;
SID=vp8csbhtgc1g42f3villuod0g7; u=2506429; n=%E7%82%B9%E7%82%B9%E5%B0%8F%E9%9B%A8%E5%B0%98; __utmc=1;
au=2367; MisCitySlug=ningbo; em=Tjs; rf=1313584922-4752116b-313552; __utmb=1.87.9.1313594355400; om=Tjs"
www.meituan.com
•            apache                ,
             mis          ,        au,
    cookie    acluserid        .
    au                        url.
•                       ,
          ,   au   id
    url
•
                   ,
•   cat www.meituan.com-110810-access_log | grep '/mis' | grep 'au=' |
    awk '{ FS="""; printf("%sau=%sn"),$2, $0;}' | awk '{FS="au=";
    printf("%s %sn"), $1,$3;}'| awk '{FS="[;”]"; print $1}' | awk '{print
    $2,$1}' |awk '{FS="?"; print $1}'| awk '{FS="/"; for(i=1;i<=NF;i++)
    {printf("%s/"),$i; if (i==4) {break;}};printf("n");}' | sed "s_//_/_g" > gui
•          awk ”                    GET /mis/
    deals/default/all/ningbo HTTP/1.0au=



•          awk ”au=”                       GET /
    mis/deals/default/all/ningbo HTTP/1.0
    2367; MisCitySlug=ningbo; em=Tjs;
•               [;”]                GET /mis/
    deals/default/all/ningbo HTTP/1.0 2367
•
,3349,,1422,/mis/frame/toggle/ || /mis/frame/side/ || /
mtm/ || /mtm/index/list/ || /mis/deals/default/ || /acl/
account/checkurl/ || /mis/deal/edit/
       ,2435,,974,/mis/frame/toggle/ || /mis/frame/side/
|| /mtm/ || /mtm/index/list/ || /acl/account/checkurl/ || /
mtm/index/ || /mis/deals/default/
grep in awk

•                 ,
    50   ,   id        ip,
         .

•     gui                    id
         apache log    .
grep in awk

•                  awk
    grep       ,         grep
           .        $0
    grep
grep in awk

• awk 'BEGIN { while (( getline < "/var/
  sankuai/wwwlogs/
  www.meituan.com-110816-access_log" >
  0))  { f2[lc] = $0; lc++;}} -F "," { name =
  "au="$2"[;|"]"; for (i = 1; i < lc; i++) {if (f2[i]
  ~ name) print f2[i];} printf("nn");}'
  zhuagui.ouput > zhuagui50
grep in awk
•    getline               log
         f2    .                 BEGIN      Pattern
                       .

•                      gui                  f2
                   .

• name                             name =
•             ,
    awk   ,
^-^

More Related Content

What's hot

What is systemd? Why use it? how does it work? - devoxx france 2017
What is systemd? Why use it? how does it work? - devoxx france 2017What is systemd? Why use it? how does it work? - devoxx france 2017
What is systemd? Why use it? how does it work? - devoxx france 2017Quentin Adam
 
Ember background basics
Ember background basicsEmber background basics
Ember background basicsPhilipp Fehre
 
What is systemd? Why use it? how does it work? - breizhcamp
What is systemd? Why use it? how does it work? - breizhcampWhat is systemd? Why use it? how does it work? - breizhcamp
What is systemd? Why use it? how does it work? - breizhcampQuentin Adam
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeMongoDB
 
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章PythonクライアントライブラリrclpyROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章PythonクライアントライブラリrclpyAtsuki Yokota
 
Finch.io - Purely Functional REST API with Finagle
Finch.io - Purely Functional REST API with FinagleFinch.io - Purely Functional REST API with Finagle
Finch.io - Purely Functional REST API with FinagleVladimir Kostyukov
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is HumanAlex Liu
 
20111030i phonedeveloperworkshoppublished
20111030i phonedeveloperworkshoppublished20111030i phonedeveloperworkshoppublished
20111030i phonedeveloperworkshoppublishedYoichiro Sakurai
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensionserwanl
 
10 tips for making Bash a sane programming language
10 tips for making Bash a sane programming language10 tips for making Bash a sane programming language
10 tips for making Bash a sane programming languageYaroslav Tkachenko
 
Library Managment System - C++ Program
Library Managment System - C++ ProgramLibrary Managment System - C++ Program
Library Managment System - C++ ProgramMuhammad Danish Badar
 
WordPressでIoTをはじめよう
WordPressでIoTをはじめようWordPressでIoTをはじめよう
WordPressでIoTをはじめようYuriko IKEDA
 
Decipher Multi-Factor Authentication - A Developers Introduction
Decipher Multi-Factor Authentication - A Developers IntroductionDecipher Multi-Factor Authentication - A Developers Introduction
Decipher Multi-Factor Authentication - A Developers IntroductionArcBlock
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Remy Sharp
 
Yearning jQuery
Yearning jQueryYearning jQuery
Yearning jQueryRemy Sharp
 
Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)ÇözümPARK
 
Zf2 how arrays will save your project
Zf2   how arrays will save your projectZf2   how arrays will save your project
Zf2 how arrays will save your projectMichelangelo van Dam
 

What's hot (20)

What is systemd? Why use it? how does it work? - devoxx france 2017
What is systemd? Why use it? how does it work? - devoxx france 2017What is systemd? Why use it? how does it work? - devoxx france 2017
What is systemd? Why use it? how does it work? - devoxx france 2017
 
Ember background basics
Ember background basicsEmber background basics
Ember background basics
 
What is systemd? Why use it? how does it work? - breizhcamp
What is systemd? Why use it? how does it work? - breizhcampWhat is systemd? Why use it? how does it work? - breizhcamp
What is systemd? Why use it? how does it work? - breizhcamp
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章PythonクライアントライブラリrclpyROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
 
InnoDB Magic
InnoDB MagicInnoDB Magic
InnoDB Magic
 
Finch.io - Purely Functional REST API with Finagle
Finch.io - Purely Functional REST API with FinagleFinch.io - Purely Functional REST API with Finagle
Finch.io - Purely Functional REST API with Finagle
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is Human
 
20111030i phonedeveloperworkshoppublished
20111030i phonedeveloperworkshoppublished20111030i phonedeveloperworkshoppublished
20111030i phonedeveloperworkshoppublished
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensions
 
10 tips for making Bash a sane programming language
10 tips for making Bash a sane programming language10 tips for making Bash a sane programming language
10 tips for making Bash a sane programming language
 
Library Managment System - C++ Program
Library Managment System - C++ ProgramLibrary Managment System - C++ Program
Library Managment System - C++ Program
 
WordPressでIoTをはじめよう
WordPressでIoTをはじめようWordPressでIoTをはじめよう
WordPressでIoTをはじめよう
 
QA for PHP projects
QA for PHP projectsQA for PHP projects
QA for PHP projects
 
Decipher Multi-Factor Authentication - A Developers Introduction
Decipher Multi-Factor Authentication - A Developers IntroductionDecipher Multi-Factor Authentication - A Developers Introduction
Decipher Multi-Factor Authentication - A Developers Introduction
 
Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)Is HTML5 Ready? (workshop)
Is HTML5 Ready? (workshop)
 
Yearning jQuery
Yearning jQueryYearning jQuery
Yearning jQuery
 
Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)
 
Ae internals
Ae internalsAe internals
Ae internals
 
Zf2 how arrays will save your project
Zf2   how arrays will save your projectZf2   how arrays will save your project
Zf2 how arrays will save your project
 

Viewers also liked

Unix command-line tools
Unix command-line toolsUnix command-line tools
Unix command-line toolsEric Wilson
 
Sed & awk the dynamic duo
Sed & awk   the dynamic duoSed & awk   the dynamic duo
Sed & awk the dynamic duoJoshua Thijssen
 
bada-data-beautiful
bada-data-beautifulbada-data-beautiful
bada-data-beautiful宗志 陈
 
Log experience
Log experienceLog experience
Log experience宗志 陈
 
Disk and page cache
Disk and page cacheDisk and page cache
Disk and page cache宗志 陈
 
Representation state transfer and some other important stuff
Representation state transfer and some other important stuffRepresentation state transfer and some other important stuff
Representation state transfer and some other important stuffJoshua Thijssen
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionJoshua Thijssen
 
15 protips for mysql users
15 protips for mysql users15 protips for mysql users
15 protips for mysql usersJoshua Thijssen
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTJoshua Thijssen
 
Alice & bob public key cryptography 101 - uncon dpc
Alice & bob  public key cryptography 101 - uncon dpcAlice & bob  public key cryptography 101 - uncon dpc
Alice & bob public key cryptography 101 - uncon dpcJoshua Thijssen
 
PFZ WorkshopDay Linux - Basic
PFZ WorkshopDay Linux - BasicPFZ WorkshopDay Linux - Basic
PFZ WorkshopDay Linux - BasicJoshua Thijssen
 
PFZ WorkshopDay Linux - Advanced
PFZ WorkshopDay Linux - AdvancedPFZ WorkshopDay Linux - Advanced
PFZ WorkshopDay Linux - AdvancedJoshua Thijssen
 
15 protips for mysql users pfz
15 protips for mysql users   pfz15 protips for mysql users   pfz
15 protips for mysql users pfzJoshua Thijssen
 

Viewers also liked (20)

Awk programming
Awk programming Awk programming
Awk programming
 
Unix command-line tools
Unix command-line toolsUnix command-line tools
Unix command-line tools
 
Sed & awk the dynamic duo
Sed & awk   the dynamic duoSed & awk   the dynamic duo
Sed & awk the dynamic duo
 
Mario
MarioMario
Mario
 
bada-data-beautiful
bada-data-beautifulbada-data-beautiful
bada-data-beautiful
 
Log experience
Log experienceLog experience
Log experience
 
Beanstalk
BeanstalkBeanstalk
Beanstalk
 
Disk and page cache
Disk and page cacheDisk and page cache
Disk and page cache
 
Pika
PikaPika
Pika
 
Moved 301
Moved 301Moved 301
Moved 301
 
Workshop unittesting
Workshop unittestingWorkshop unittesting
Workshop unittesting
 
Representation state transfer and some other important stuff
Representation state transfer and some other important stuffRepresentation state transfer and some other important stuff
Representation state transfer and some other important stuff
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
 
15 protips for mysql users
15 protips for mysql users15 protips for mysql users
15 protips for mysql users
 
Deploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APTDeploying and maintaining your software with RPM/APT
Deploying and maintaining your software with RPM/APT
 
Alice & bob public key cryptography 101 - uncon dpc
Alice & bob  public key cryptography 101 - uncon dpcAlice & bob  public key cryptography 101 - uncon dpc
Alice & bob public key cryptography 101 - uncon dpc
 
PFZ WorkshopDay Linux - Basic
PFZ WorkshopDay Linux - BasicPFZ WorkshopDay Linux - Basic
PFZ WorkshopDay Linux - Basic
 
PFZ WorkshopDay Linux - Advanced
PFZ WorkshopDay Linux - AdvancedPFZ WorkshopDay Linux - Advanced
PFZ WorkshopDay Linux - Advanced
 
15 protips for mysql users pfz
15 protips for mysql users   pfz15 protips for mysql users   pfz
15 protips for mysql users pfz
 
Level db
Level dbLevel db
Level db
 

Similar to Analyzing Apache Logs with Awk

Go Web Development
Go Web DevelopmentGo Web Development
Go Web DevelopmentCheng-Yi Yu
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupBadoo Development
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesOdoo
 
Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識維泰 蔡
 
Introduction to Apache Spark / PUT 06.2014
Introduction to Apache Spark / PUT 06.2014Introduction to Apache Spark / PUT 06.2014
Introduction to Apache Spark / PUT 06.2014bbogacki
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhDIVYA SINGH
 
Python And GIS - Beyond Modelbuilder And Pythonwin
Python And GIS - Beyond Modelbuilder And PythonwinPython And GIS - Beyond Modelbuilder And Pythonwin
Python And GIS - Beyond Modelbuilder And PythonwinChad Cooper
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeLogstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeAndrea Cardinale
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak PROIDEA
 
Divolte Collector - meetup presentation
Divolte Collector - meetup presentationDivolte Collector - meetup presentation
Divolte Collector - meetup presentationfvanvollenhoven
 
Steering Iterative and Incremental Delivery with Jeff Patton
Steering Iterative and Incremental Delivery with Jeff PattonSteering Iterative and Incremental Delivery with Jeff Patton
Steering Iterative and Incremental Delivery with Jeff PattonUIEpreviews
 
Piwik elasticsearch kibana at OSC Tokyo 2016 Spring
Piwik elasticsearch kibana at OSC Tokyo 2016 SpringPiwik elasticsearch kibana at OSC Tokyo 2016 Spring
Piwik elasticsearch kibana at OSC Tokyo 2016 SpringTakashi Yamamoto
 
Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logsStefan Krawczyk
 
Архитектура коммутаторов Cisco Catalyst 6500
Архитектура коммутаторов Cisco Catalyst 6500Архитектура коммутаторов Cisco Catalyst 6500
Архитектура коммутаторов Cisco Catalyst 6500Cisco Russia
 
Aplicações 10x a 100x mais rápida com o postgre sql
Aplicações 10x a 100x mais rápida com o postgre sqlAplicações 10x a 100x mais rápida com o postgre sql
Aplicações 10x a 100x mais rápida com o postgre sqlFabio Telles Rodriguez
 
ELK stack at weibo.com
ELK stack at weibo.comELK stack at weibo.com
ELK stack at weibo.com琛琳 饶
 

Similar to Analyzing Apache Logs with Awk (20)

Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance Issues
 
Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識Linux 系統管理與安全:基本 Linux 系統知識
Linux 系統管理與安全:基本 Linux 系統知識
 
Explain this!
Explain this!Explain this!
Explain this!
 
Introduction to Apache Spark / PUT 06.2014
Introduction to Apache Spark / PUT 06.2014Introduction to Apache Spark / PUT 06.2014
Introduction to Apache Spark / PUT 06.2014
 
Mcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singhMcs011 solved assignment by divya singh
Mcs011 solved assignment by divya singh
 
Python And GIS - Beyond Modelbuilder And Pythonwin
Python And GIS - Beyond Modelbuilder And PythonwinPython And GIS - Beyond Modelbuilder And Pythonwin
Python And GIS - Beyond Modelbuilder And Pythonwin
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeLogstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtime
 
Pdxpugday2010 pg90
Pdxpugday2010 pg90Pdxpugday2010 pg90
Pdxpugday2010 pg90
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
 
Divolte Collector - meetup presentation
Divolte Collector - meetup presentationDivolte Collector - meetup presentation
Divolte Collector - meetup presentation
 
Steering Iterative and Incremental Delivery with Jeff Patton
Steering Iterative and Incremental Delivery with Jeff PattonSteering Iterative and Incremental Delivery with Jeff Patton
Steering Iterative and Incremental Delivery with Jeff Patton
 
Piwik elasticsearch kibana at OSC Tokyo 2016 Spring
Piwik elasticsearch kibana at OSC Tokyo 2016 SpringPiwik elasticsearch kibana at OSC Tokyo 2016 Spring
Piwik elasticsearch kibana at OSC Tokyo 2016 Spring
 
Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logs
 
Rack Middleware
Rack MiddlewareRack Middleware
Rack Middleware
 
Архитектура коммутаторов Cisco Catalyst 6500
Архитектура коммутаторов Cisco Catalyst 6500Архитектура коммутаторов Cisco Catalyst 6500
Архитектура коммутаторов Cisco Catalyst 6500
 
Aplicações 10x a 100x mais rápida com o postgre sql
Aplicações 10x a 100x mais rápida com o postgre sqlAplicações 10x a 100x mais rápida com o postgre sql
Aplicações 10x a 100x mais rápida com o postgre sql
 
ELK stack at weibo.com
ELK stack at weibo.comELK stack at weibo.com
ELK stack at weibo.com
 

Recently uploaded

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Recently uploaded (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Analyzing Apache Logs with Awk

  • 1. awk
  • 2. awk • · Peter Weinberger Brian Kernighan •
  • 3. awk • sed , awk .
  • 5. • last chenggan pts/467 192.168.130.29 Thu Aug 18 15:39 still logged in chenggan pts/446 192.168.130.29 Thu Aug 18 15:38 still logged in chenggan pts/414 192.168.130.29 Thu Aug 18 15:33 still logged in chenggan pts/414 192.168.130.29 Thu Aug 18 15:26 - 15:32 (00:06) lixinhe pts/413 192.168.130.34 Thu Aug 18 15:25 still logged in lixinhe pts/521 192.168.130.34 Thu Aug 18 15:09 still logged in xuzhang pts/509 192.168.129.2 Thu Aug 18 15:03 still logged in
  • 6. ip
  • 7. • last | awk ‘{printf $1, $3}’ chenggan 192.168.130.29 chenggan 192.168.130.29 chenggan 192.168.130.29 chenggan 192.168.130.29 lixinhe 192.168.130.34 lixinhe 192.168.130.34 xuzhang 192.168.129.2
  • 8. awk • , $0,$1,$2... . • Pattern { Actions } Action • { Actions } • ,
  • 9. chenggan pts/467 192.168.130.29 Thu Aug 18 15:39 still logged in $0 = chenggan pts/467 192.168.130.29 Thu Aug 18 15:39 still logged in $1 = chenggan $2 = pts/467 $3 = 192.168.130.29 $4 = Thu $5 = Aug Pattern . Action print $1, $3 $1 $3
  • 10. awk • FILENAME • FS , • NF , • OFS • FNR
  • 11. • cat /etc/passwd beanstalkd:x:107:110:beanstalkd user:/var/lib/beanstalkd:/bin/false postfix:x:89:89::/var/spool/postfix:/sbin/nologin privoxy:x:73:73::/etc/privoxy:/sbin/nologin _tor:x:108:514:Tor user:/var/lib/tor:/bin/false murongjun:x:518:501::/home/murongjun:/bin/bash liying:x:519:501::/home/liying:/bin/bash
  • 12. • • ?
  • 13. cat /etc/passwd | awk '{ FS=":"; print $1, $6;}' beanstalkd /var/lib/beanstalkd postfix /var/spool/postfix privoxy /etc/privoxy _tor /var/lib/tor murongjun /home/murongjun liying /home/liying
  • 14. cat /etc/passwd | awk '{ FS=":"; OFS = " || "; print $1, $6;}' beanstalkd || /var/lib/beanstalkd postfix || /var/spool/postfix privoxy || /etc/privoxy _tor || /var/lib/tor murongjun || /home/murongjun liying || /home/liying
  • 15. , , id, , . cityid. • php , sql . • php 20 ,awk 1
  • 16. 107255,"2011-06-17"," ",15201095922,0 663805,"2011-07-18"," ",13521050527,0 346569,"2011-05-31"," ",84920575,84920575 268831,"2011-05-29"," ",13601180538,0 551017,"2011-04-20"," ",84920575,84855168
  • 17. awk -F "," '{ printf "insert into dealrevisit values (%s,%s,%s,10,0,UNIX_TIMESTAMP());n", $1, $3, $4;}' beijing > insert.sql
  • 18. insert into dealrevisit value (967898," ",13681190863,10,0,UNIX_TIMESTAMP()); insert into dealrevisit value (582907," ",13901316805,10,0,UNIX_TIMESTAMP()); insert into dealrevisit value (734974," ",15010372631,10,0,UNIX_TIMESTAMP()); insert into dealrevisit value (868768," ",18600011579,10,0,UNIX_TIMESTAMP());
  • 19. FS ,FS , . • FS AWK
  • 20. Pattern { Action } • Pattern { Action } AWK . • Pattern, Action
  • 21. Pattern { Action } • AWK Pattern • awk ‘BEGIN{Action}; Pattern{Action};Pattern {Action};...; END{Action}’ file
  • 22. BEGIN AND END • BEGIN AND Pattern • BEGIN • END
  • 23. ...... create mode 100644 mis/template/mobileads/list.php create mode 100644 model/MobileadsModel.php create mode 100644 model/TpBankBranchModel.php create mode 100644 model/TpBankInfoModel.php create mode 100644 model/TpPaymentLogModel.php create mode 100644 sql/110818_moddeallog.sql <em:version>0.1.3</em:version> ......
  • 24. 0.1.3
  • 25. <em:version>...
  • 26. awk '$0 ~ /<em:version>[^<]*</em:version>/ {print $0;}' install.rdf |awk -F '>' '{print $2}'|awk -F '<' '{print $1}'
  • 27. $0 ~ /<em:version>[^<]*</em:version>/ Pattern. • $0 , / <em:version>[^<]*</em:version>/ • {print $0;} Action
  • 28. awk <em:version>0.1.3</ em:version> • awk > 0.1.3</ em:version • awk < 0.1.3
  • 29. Pattern { Action } • AWK
  • 30. 202.106.58.18 - - [15/Aug/2011:23:59:42 +0800] 735802 - "GET /acl/account/checkurl?url=/mis/deals/default/all/ jining&citySlug=jilin HTTP/1.0" 302 - "http:// www.meituan.com/mis/" .... 221.223.96.234 - - [15/Aug/2011:23:59:58 +0800] 450858 - "GET /deal/1105.html HTTP/1.0" 200 2132 "http:// www.meituan.com/mis/account/login"
  • 31. apache • url , url url • url mis • grep , grep
  • 32. • awk ' $9 ~ /mis/ { print $0}' log
  • 33. • awk awk B
  • 34. Pattern { Action } • AWK Pattern >,< • awk '$1 + $2 < 100' test 100 Pattern Action, Action • AWK Pattern !~ .
  • 35. awk • awk shell , awk
  • 36. 3199, , ,187****9445, BD ( ) 3228, , ,136****9587, BD ( ) 2962, , ,136****7116, BD ( ) 2963, , ,137****0897, BD ( ) 5554, , ,186****2154, 4838, , ,134****7617, BD ( ) 4882, , ,139****5562, BD ( )
  • 37. .
  • 38. php , 20 ,awk 1
  • 39. awk 'BEGIN {FS=","} { print $0 >>$2; close($2);}' cityuser
  • 40. , . $2 . • close • awk close()
  • 41. awk • getline . • getline , . • ,getline 1, 0, , , -1.
  • 42. • awk 'BEGIN { while("who" | getline) n++; print n;}' • .
  • 43. awk 'BEGIN {"date" | getline dtime; print dtime}' • • data dtime,
  • 44. 202.106.58.18 - - [17/Aug/2011:23:59:51 +0800] 1042839 - "GET /mis/deals/default/all/ningbo HTTP/1.0" 200 17505 "http:// www.meituan.com/mis/frame/side?city=ningbo" "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0" "uuid=13ce7442b68505d69df7.1297390972.68.4.1; __utma=1.64891309.1297390974.1313584928.1313594207.499; __utmz=1.1313594207.499.164.utmcsr=%28none%29|utmccn=UserReferral|utmcmd=im|utmctr=index|utmcct=u313552; mb=15210890172; ci=135; __utmv=1.|1=city=yuncheng=1,2=user=BD=1; abt=1313544681%7CADF; m=chuan_ye_lony %40163.com; al=HRPAxN_gimR2EVusR69-AhDTM2t0V-Z7ENMza3RX5nvXmpHDt8V-XQ; SID=vp8csbhtgc1g42f3villuod0g7; u=2506429; n=%E7%82%B9%E7%82%B9%E5%B0%8F%E9%9B%A8%E5%B0%98; __utmc=1; au=2367; MisCitySlug=ningbo; em=Tjs; rf=1313584922-4752116b-313552; __utmb=1.87.9.1313594355400; om=Tjs" www.meituan.com
  • 45. apache , mis , au, cookie acluserid . au url.
  • 46. , , au id url • ,
  • 47. cat www.meituan.com-110810-access_log | grep '/mis' | grep 'au=' | awk '{ FS="""; printf("%sau=%sn"),$2, $0;}' | awk '{FS="au="; printf("%s %sn"), $1,$3;}'| awk '{FS="[;”]"; print $1}' | awk '{print $2,$1}' |awk '{FS="?"; print $1}'| awk '{FS="/"; for(i=1;i<=NF;i++) {printf("%s/"),$i; if (i==4) {break;}};printf("n");}' | sed "s_//_/_g" > gui
  • 48. awk ” GET /mis/ deals/default/all/ningbo HTTP/1.0au= • awk ”au=” GET / mis/deals/default/all/ningbo HTTP/1.0 2367; MisCitySlug=ningbo; em=Tjs;
  • 49. [;”] GET /mis/ deals/default/all/ningbo HTTP/1.0 2367 •
  • 50. ,3349,,1422,/mis/frame/toggle/ || /mis/frame/side/ || / mtm/ || /mtm/index/list/ || /mis/deals/default/ || /acl/ account/checkurl/ || /mis/deal/edit/ ,2435,,974,/mis/frame/toggle/ || /mis/frame/side/ || /mtm/ || /mtm/index/list/ || /acl/account/checkurl/ || / mtm/index/ || /mis/deals/default/
  • 51. grep in awk • , 50 , id ip, . • gui id apache log .
  • 52. grep in awk • awk grep , grep . $0 grep
  • 53. grep in awk • awk 'BEGIN { while (( getline < "/var/ sankuai/wwwlogs/ www.meituan.com-110816-access_log" > 0))  { f2[lc] = $0; lc++;}} -F "," { name = "au="$2"[;|"]"; for (i = 1; i < lc; i++) {if (f2[i] ~ name) print f2[i];} printf("nn");}' zhuagui.ouput > zhuagui50
  • 54. grep in awk • getline log f2 . BEGIN Pattern . • gui f2 . • name name =
  • 55. , awk ,
  • 56. ^-^

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n