What is the difference between wildcard and regular? Linux entry learning

What is the difference between wildcard and regular?

name effect Supported commands
Wildcard Facilitate us to find files Most commands under Linux support
Regular Convenient for us to filter (find the content in the file) Linux Three Musketeers Development Language Python Go PHP JAVA

Wildcard:

It is convenient for us to find files
. Many commands under Linux and even windows are supported.

ls  /oldboy/*.txt    #找出以.txt结尾的文件
find /oldboy/  -type f -name '*.log' #找出/oldboy下以.txt结尾的文件
touch lidao{01..10}.txt                   #创建多个文件

Regular expression

To facilitate our filtering

Filter out lines containing 3306 or 1521 in the /etc/services file

[root@oldboyedu59 ~]# egrep '3306|1521'   /etc/services 
mysql           3306/tcp                        # MySQL
mysql           3306/udp                        # MySQL
ncube-lm        1521/tcp                # nCube License Manager
ncube-lm        1521/udp                # nCube License Manager

Find the line starting with ssh in this file

[root@oldboyedu59 ~]# grep '^ssh' /etc/services
ssh             22/tcp                          # The Secure Shell (SSH) Protocol
ssh             22/udp                          # The Secure Shell (SSH) Protocol
ssh             22/sctp                 # SSH
sshell          614/tcp                 # SSLshell
sshell          614/udp                 #       SSLshell
ssh-mgmt        17235/tcp               # SSH Tectia Manager
ssh-mgmt        17235/udp               # SSH Tectia Manager 

Guess you like

Origin blog.51cto.com/7681914/2554478