So far so good , but how exactly do we select a substring or even a single character from a string 到现在为止一切不错,但我们究竟如何从字符串中选择子串,甚至单个字符?
Replaces each substring of this string that matches the given regular expression with the given replacement 只有两个参数,第一个参数是要进行匹配的子串,第二个是替换串。
Each value in the array specifies the offset , in bytes , from the beginning of the string to the clause 数组中的每个值在字节级别上(以字节为单位)确定了子串由字符串算起的偏移量。
The clause information is an array of 32 - bit values that specifies the positions of the clauses in the composition string 子串信息是一个32位值的数组,用于确定子串在字母组合字符串中的位置。
For instance , it currently supports finding words with similar prefixes or suffixes , or words that share some substring 例如,它目前支持查找带有相似前缀或后缀的单词,支持共享某些子串的单词查找。
The [ i ] clause information [ / i ] is an array of 32 - bit values that specifies the positions of the clauses in the composition string 子串信息是一个32位值的数组,用于确定子串在字母组合字符串中的位置。
String . substr n , length , pad , string . subword . . . extracts a substring of characters or words string at n for length with optional padding 从字符串的位置n开始提取指定长度的字符或单词子串,并用可选的填充字符填充
You ll need to use it to extract single characters and substrings ; because awk is a string - based language , you ll be using it often 需要使用它来抽取单个字符和子串;因为awk是基于字符串的语言,所以会经常用到它。
Match is a lot like index , except instead of searching for a substring like index does , it searches for a regular expression Match ( )与index ( )非常相似,它与index ( )的区别在于它并不搜索子串,它搜索的是规则表达式。
The substring function returns the substring of the first argument starting at the position specified in the second argument with length specified in the third argument Substring ( )函数传回第一个参数的子串,子串的起始位置由第二个参数指定,子串的长度由第三个参数指定。