This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
команды_фильтры [2018/07/10 09:50] val |
команды_фильтры [2018/08/22 09:55] val [cut] |
||
---|---|---|---|
Line 7: | Line 7: | ||
<code> | <code> | ||
- | $ cut -d: -f1 /etc/passwd | ||
$ cut -d: -f1,7 /etc/passwd | $ cut -d: -f1,7 /etc/passwd | ||
- | $ cut -d: -f1-3 /etc/passwd | + | |
$ cut -c1-5 /etc/passwd | $ cut -c1-5 /etc/passwd | ||
+ | |||
+ | $ cat /etc/passwd | rev | cut -c 2- | rev #remove last character | ||
</code> | </code> | ||
Line 21: | Line 22: | ||
$ df -h / | tr -s ' ' | $ df -h / | tr -s ' ' | ||
+ | |||
+ | # echo "{\"hw_id\":\"2\",\"hw_name\":\"router\"}" | tr -d '{}\\' | ||
</code> | </code> | ||
Line 86: | Line 89: | ||
* [[https://stackoverflow.com/questions/14928573/sed-how-to-extract-ip-address-using-sed|sed - How to extract IP address using sed?]] | * [[https://stackoverflow.com/questions/14928573/sed-how-to-extract-ip-address-using-sed|sed - How to extract IP address using sed?]] | ||
- | * [[Генератор отчетов awk#Подсчет количества элементов]] | + | * Генератор отчетов awk [[Генератор отчетов awk#Выбор строк по числовому условию]] |
<code> | <code> | ||
- | # grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' /var/log/auth.log | sort | uniq -c | sort -n | + | # cat /var/log/auth.log | grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' | sort | uniq -c | sort -n |
</code> | </code> |