当前位置:网站首页>Regular expression gadget series
Regular expression gadget series
2022-07-27 01:42:00 【Strange mushrooms】
Regular expression gadget series
List of articles
One 、cut Column interceptor
Specify the interception column and awk almost , But it can be more accurate
| Options | explain |
|---|---|
| -b | Intercept by byte |
| -c | Intercept by character , Commonly used in Chinese |
| -d | Specify what is the delimiter to intercept , Default tab |
| -f | Usually and -d Together |
example :

experiment -c When I was too lazy to type, I wrote a name generator ( I mean, I wrapped this bowl of dumplings for this dish of vinegar )

Two 、sort Sorting tools
You can sort the contents of the file , You can also sort according to different data types ( In Chinese, follow the English alphabetic order of Pinyin )
| Options | explain |
|---|---|
| -t | Specify the separator |
| -k | Specify sorting area , That interval sort |
| -n | Sort by number , Default text form sorting |
| -u | Only one row of the same data is displayed |
| -r | Descending , The default sort is ascending |
| -o | Transfer the sorting structure to the specified file and > equally |

[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-13xwRvqJ-1657783119834)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707140017862.png)]
3、 ... and 、uniq duplicate removal
| Options | effect |
|---|---|
| -c | Count duplicate lines |
| -d | Show only duplicate lines |
| -u | Show only rows that appear once |
example [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-KC3rT58j-1657783119835)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707140841541.png)]

Four 、tr Replace
| Options | explain |
|---|---|
| -d | Delete character |
| -s | Delete all duplicate characters , And only keep the first |
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-LEtGtT4b-1657783119836)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707144812435.png)]
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-14TTXFEK-1657783119836)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707144904805.png)]
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-U5UZFgZa-1657783119837)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707145126615.png)]
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-Wk5o5usg-1657783119838)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707145351255.png)]
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-d4VM5g9d-1657783119838)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707145543927.png)]
5、 ... and 、 Mixed topic
1. Count the current number of host connections
Counting the number of connections is mainly about tcp Of ip extracted , All use netstat -natp
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-VE1jhKZd-1657783119839)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707153551425.png)]
I want to ip If that column is extracted, it is generally used cut, But there are too many spaces , Use cut Cannot define interval , So we need to add extra " " Replace with tr-s // Remove duplicate characters
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-kvYNOYg1-1657783119839)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707155124337.png)]
Intercepted , It turns out that there are several IPV6 Of IP It's not what we need , We can limit the format 255.255.255.255, This will filter out clean ip Address
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-Sc8ZDfWQ-1657783119840)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707155710971.png)]
As a result, something speechless happened , Followed by the port number , We also need cut-d Exclude port numbers
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-JnHRAqLk-1657783119840)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707155858321.png)]
Then sort first and then count , because uniq It's a fool , Only continuous
d Exclude port numbers
[ Outside the chain picture transfer in ...(img-JnHRAqLk-1657783119840)]
Then sort first and then count , because uniq It's a fool , Only continuous
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-U7FLv6kP-1657783119841)(C:\Users\Mogu\AppData\Roaming\Typora\typora-user-images\image-20220707160108048.png)]
边栏推荐
- [Oracle] get the latest working day and the previous N working days
- Longest substring without duplicate characters
- 十四、sed
- Ubuntu12.10安装Mysql5.5(三)
- Jenkins -- Basic -- 03 -- post installation setup wizard
- 数组的定义
- Producer consumer model of concurrent programming
- ESP8266 STA_ UDP_ Client
- Problem feedback: the synchronization of mobile app failed: the external changes of the data warehouse were damaged. The iPad app also downloaded the warehouse as soon as it was opened, and then flash
- VirtualBox VMS extended disk space
猜你喜欢
随机推荐
4、 Operation of numerical variables
String容器的底层实现
域名分析和DNS的配置安装
【无标题】
shell循环语句
[cloud native | learn kubernetes from scratch] VI. kubernetes core technology pod
Esp8266---json---c function library provides string functions
Shell(12)正则表达式
十一、echo
[mysql] what happens when things are executed concurrently?
1100: finding the number of combinations (function topic)
Lnmp+discuz Forum
Plantcv Chinese document
PXE实验
9、 Bubble sort
Longest substring without duplicate characters
Understanding and learning of code blocks
iptables防火墙(二)
Shell编程规范与变量
29shell function

![[by pass] bypass method of file upload](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)







