User Tools

Site Tools


linux:bash:command-awk

This is an old revision of the document!


Bash Command AWK

Bash command ini digunakan untuk berbagai tujuan

AWK Memotong script Tail pada string tertentu

Tujuannya untuk memotong dan mendapatkan string tertentu yang dihasilkan dari output via tail atau cat

Contoh Log file

Sep 30 16:15:27 cluster-imap-proxy1 dovecot: imap-login: proxy(xxxxxng@kibinternational.com): Login failed to server.net:143: [AUTHENTICATIONFAILED] Authentication failed.: user=<xxxxg@kibinternational.com>, method=PLAIN, rip=36.89.38.225, lip=51.79.129.55, session=<hTSlVoSwkAskWSbh>
Sep 30 16:15:27 cluster-imap-proxy1 dovecot: imap-login: Disconnected (proxy dest auth failed): user=<xxxxxg@kibinternational.com>, method=PLAIN, rip=36.89.38.225, lip=51.79.129.55, session=<hTSlVoSwkAskWSbh>

string yang ingin didapatkan adalah

rip=36.89.38.225

Maka

awk -F"rip=" ' {print $2}' /var/log/maillog

Layanan

Harga Domain .COM | Harga Domain .ID | Shared Hosting | Email Hosting | MySQL Hosting |
linux/bash/command-awk.1601457496.txt.gz · Last modified: 2020/09/30 05:18 by kbadmin

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki