User Tools

Site Tools


linux:bash:command-cut

Bash Command Cut

Command cut berfungsi untuk memotong string dan berikut adalah beberapa tutorial

Menghapus comma dari hasil tail

Menghapus string comma dari hasil output tail

file log

140.213.7.40, lip=51.79.129.55, TLS, session=<srEfkWiwrZiM1Qco>
140.213.7.40, lip=51.79.129.55, TLS, session=<srEfkWiwrZiM1Qco>
139.99.30.6, lip=51.79.129.55, session=<h6hSkWiwjqeLYx4G>
139.99.30.6, lip=51.79.129.55, session=<h6hSkWiwjqeLYx4G>
114.122.203.12, lip=51.79.129.55, TLS, session=<bsaqkWiwFthyessM>

dilakukan filter dengan cara

tail -n 200 /var/log/maillog | grep failed | awk -F"rip=" ' {print $2}' | cut -d, --output-delimiter ' ' -f 1,2

hasil output

125.161.136.199  lip=51.79.129.55
125.161.131.93  lip=51.79.129.55
125.161.131.93  lip=51.79.129.55
114.124.142.92  lip=51.79.129.55
36.88.112.185  lip=51.79.129.55

Layanan

Harga Domain .COM | Harga Domain .ID | Shared Hosting | Email Hosting | MySQL Hosting |
linux/bash/command-cut.txt · Last modified: 2020/09/30 05:20 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