1. Remove the left character and leave the right character
1). Use # Intercept
Example: str= "http://www.baidu.com"
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/82/DC/wKioL1djQu_CLXeEAAAzIuXnc10469.png-wh_500x0-wm_3 -wmp_4-s_3281320150.png "title=" 1.png "alt=" Wkiol1djqu_clxeeaaaziuxnc10469.png-wh_50 "/>
Where *//indicates that all characters before the first//delimiter are deleted from the leftmost start #是运算符
2). Double # intercept
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/82/DD/wKiom1djQ1fToUkhAABDvZNzU40514.png-wh_500x0-wm_3 -wmp_4-s_4001337959.png "title=" 2.png "alt=" Wkiom1djq1ftoukhaabdvznzu40514.png-wh_50 "/>
##*/indicates that the last/delimiter and all characters preceding it are deleted from the leftmost start
2. Delete the right character and leave the left character
1). Use% intercept
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/82/DD/wKiom1djRDyT4gTJAABLleYi50M110.png-wh_500x0-wm_3 -wmp_4-s_3705840128.png "title=" 3.png "alt=" Wkiom1djrdyt4gtjaablleyi50m110.png-wh_50 "/>
%*/indicates that the first/delimiter and all characters to the right are deleted from the far right.
2). Double% intercept
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/82/DC/wKioL1djRfjB8AfcAABGMAGR7g8850.png-wh_500x0-wm_3 -wmp_4-s_36416502.png "title=" 4.png "alt=" Wkiol1djrfjb8afcaabgmagr7g8850.png-wh_50 "/>
%%/* indicates that the last/delimiter and all characters to the right are removed from the far right.
3. How many characters are removed from the left
The leftmost first character is represented by 0, and the first character on the right is denoted by 0-1.
1). Delete the middle few characters
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/82/DD/wKiom1djRa3i_mHLAABDKrP2MkY171.png-wh_500x0-wm_3 -wmp_4-s_4124928051.png "title=" 5.png "alt=" Wkiom1djra3i_mhlaabdkrp2mky171.png-wh_50 "/>
The middle colon means that the intercept starts at the left of the first few characters to the end of the first character
2). Start with the first few characters on the left until the end
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/82/DC/wKioL1djSN2iwBbHAABL-2kEWng957.png-wh_500x0-wm_3 -wmp_4-s_1104863479.png "title=" 6.png "alt=" Wkiol1djsn2iwbbhaabl-2kewng957.png-wh_50 "/>
Represents all characters starting at the 7th character from the left until the end
4. Starting from the right, how many characters to intercept
1). How many characters are truncated from the first character to the right
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/82/DD/wKiom1djSL2SMnJrAABEYej3oOc425.png-wh_500x0-wm_3 -wmp_4-s_250029456.png "title=" 7.png "alt=" Wkiom1djsl2smnjraabeyej3ooc425.png-wh_50 "/>
7-character-length content starting from the 12th character on the right
2). Start with the first few characters on the right until the end of the interception
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/82/DD/wKiom1djSUbTzsXbAAA1uMV1NpM053.png-wh_500x0-wm_3 -wmp_4-s_400742466.png "title=" 8.png "alt=" Wkiom1djsubtzsxbaaa1umv1npm053.png-wh_50 "/>
Starts with the 12th character from the right, and intercepts all the characters behind it.
5. Truncate the contents of a string to a specified substring
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/82/DD/wKiom1djTgPRsT4DAAA-x7XC1rw318.png-wh_500x0-wm_3 -wmp_4-s_1572208951.png "title=" 9.png "alt=" Wkiom1djtgprst4daaa-x7xc1rw318.png-wh_50 "/>
The first instruction indicates that the matching string str1 is searched from the left of the string str, and if there is no match or incomplete match, the original string is displayed, otherwise the truncated string is displayed, starting from the right to use ${str%% $str 1}
To intercept a string in a shell script