linux正则表达式函数式_Linux正则表达式能力问题和解答

linux正则表达式函数式

This section contains Aptitude Questions and Answers on Linux Regular Expressions.

本节包含有关Linux正则表达式的 Aptitude问答。

1) There are the following statements that are given below, which of them are correct about Regular expressions in the Linux operating system?
  1. The regular expressions are strings that are used for pattern matching in some Linux commands.

  2. The regular expressions are also known as a regex.

  3. The regular expressions use some characters that each has a different meaning.

  4. Regular expressions can only be used in the Linux commands.

Options:

  1. A and B

  2. C and D

  3. A, B, and C

  4. A, B, C, and D

Answer & Explanation

Correct answer: 3
A, B, and C

Statements A, B, and C are correct about regular expressions.

1)下面给出了以下语句,其中哪些对于Linux操作系统中的正则表达式是正确的?
  1. 正则表达式是在某些Linux命令中用于模式匹配的字符串。

  2. 正则表达式也称为正则表达式。

  3. 正则表达式使用一些具有不同含义的字符。

  4. 正则表达式只能在Linux命令中使用。

选项:

  1. A和B

  2. C和D

  3. A,B和C

  4. A,B,C和D

答案与解释

正确答案:3
A,B和C

语句A,B和C关于正则表达式是正确的。

2) Which of the following command uses regular expressions in the Linux operating system?
  1. grep

  2. sed

  3. rename

  4. bash

Options:

  1. A and B

  2. C and D

  3. A, B, and C

  4. A, B, C, and D

Answer & Explanation

Correct answer: 4
A, B, C, and D

All given commands are used with regular expressions in the Linux operating system.

2)以下哪个命令在Linux操作系统中使用正则表达式?
  1. grep

  2. sed

  3. 改名

  4. 重击

选项:

  1. A和B

  2. C和D

  3. A,B和C

  4. A,B,C和D

答案与解释

正确答案:4
A,B,C和D

在Linux操作系统中,所有给定命令都与正则表达式一起使用。

3) Which of the following types of regular expressions are used in the Linux operating system?
  1. Basic Regular Expression

  2. Extended Regular Expression

  3. Crond Regular Expression

  4. Perl Regular Expression

Options:

  1. A and B

  2. A, B, and D

  3. A, B, and C

  4. A, B, C, and D

Answer & Explanation

Correct answer: 2
A, B, and D

Options A, B, and D are the correct types of regular expressions used in the Linux operating system.

3)在Linux操作系统中使用以下哪种正则表达式?
  1. 基本正则表达式

  2. 扩展正则表达式

  3. Crond正则表达式

  4. Perl正则表达式

选项:

  1. A和B

  2. A,B和D

  3. A,B和C

  4. A,B,C和D

答案与解释

正确答案:2
A,B和D

选项A,B和D是Linux操作系统中使用的正确正则表达式类型。

4) Which of the following option is used for a basic regular expression in the grep command?
  1. -B

  2. -G

  3. -P

  4. -E

Answer & Explanation

Correct answer: 2
-G

The option -G is used for a basic regular expression in the grep command.

4)以下哪个选项用于grep命令中的基本正则表达式?
  1. -B

  2. -G

  3. -P

  4. -E

答案与解释

正确答案:2
-G

选项-G用于grep命令中的基本正则表达式。

5) Which of the following is used to match any set of characters from the specified file in the grep command?
  1. ()

  2. {}

  3. []

  4. ##

Answer & Explanation

Correct answer: 3
[]

The [] is used to match any set of characters from the specified file in the grep command.

5)以下哪项用于匹配grep命令中指定文件中的任何字符集?
  1. ()

  2. {}

  3. []

  4. ##

答案与解释

正确答案:3
[]

[]用于匹配grep命令中指定文件中的任何字符集。

6) Which of the following symbols are used for a regular expression in the Linux?
  1. $

  2. ?

  3. _

  4. +

Options:

  1. A and B

  2. A, B, and D

  3. A, B, and C

  4. A, B, C, and D

Answer & Explanation

Correct answer: 4
A, B, C, and D

All given symbols are used for regular expressions.

6)在Linux中,以下哪个符号用于正则表达式?
  1. $

  2. _

  3. +

选项:

  1. A和B

  2. A,B和D

  3. A,B和C

  4. A,B,C和D

答案与解释

正确答案:4
A,B,C和D

所有给定的符号都用于正则表达式。

7) Which of the following symbol is used to match exactly one character?
  1. $

  2. ?

  3. _

  4. +

Answer & Explanation

Correct answer: 2
?

The question mark (?) is used to match exactly one character.

7)以下哪个符号用于精确匹配一个字符?
  1. $

  2. _

  3. +

答案与解释

正确答案:2

问号( ? )用于精确匹配一个字符。

8) Which of the following symbol is used to match preceding character N times or more than N times?
  1. (N)

  2. (N,)

  3. {N}

  4. {N,}

Answer & Explanation

Correct answer: 4
{N,}

8)以下哪个符号用于匹配N次或N次以上的前一个字符?
  1. (N)

  2. (N)

  3. {N}

  4. {N,}

答案与解释

正确答案:4
{N,}

9) Which of the following symbol is used to represent the group of characters?
  1. /

  2. \

  3. +

  4. -

Answer & Explanation

Correct answer: 2
\

The backward slash (\) is used to represent the group of characters.

9)以下哪个符号用来表示字符组?
  1. /

  2. \

  3. +

  4. --

答案与解释

正确答案:2
\

反斜杠( \ )用来表示字符组。

10) Which of the following symbol is used to group regular expressions?
  1. []

  2. ()

  3. {}

  4. <>

Answer & Explanation

Correct answer: 2
()

The parentheses are used to group regular expressions.

10)以下哪个符号用于对正则表达式进行分组?
  1. []

  2. ()

  3. {}

  4. <>

答案与解释

正确答案:2
()

括号用于对正则表达式进行分组。

11) Which of the following symbol is used to match the empty string at the edge of a word?
  1. \<

  2. \>

  3. \B

  4. \b

Answer & Explanation

Correct answer: 4
\b

The backslash b (\b) is used to match the empty string at the edge of a word.

11)以下哪个符号用于匹配单词边缘的空字符串?
  1. \ <

  2. \>

  3. \ B

  4. \ b

答案与解释

正确答案:4
\ b

反斜杠b( \ b )用于匹配单词边缘的空字符串。

12) Which of the following symbol is used to match the empty string if it is not at the edge of a word?
  1. \<

  2. \>

  3. \B

  4. \E

Answer & Explanation

Correct answer: 4
\B

The backslash B (\B) is used to match the empty string if it is not at the edge of a word.

12)如果空字符串不在单词的边缘,则以下哪个符号用于匹配空字符串?
  1. \ <

  2. \>

  3. \ B

  4. \ E

答案与解释

正确答案:4
\ B

如果空字符串不在单词的边缘,则使用反斜杠B( \ B )来匹配它。

13) Which exact command is used, when we want to search words in the file that can be "ABC1", "ABC5", and "ABC8"?
  1. grep "ABC[0-9]" <filename>

  2. grep "ABC(0-9)" <filename>

  3. grep "ABC(0-9)" <filename>

  4. grep "ABC(0-9)" <filename>

Answer & Explanation

Correct answer: 1
grep "ABC[0-9]" <filename>

The first option is correct.

13)当我们要在文件中搜索可以是“ ABC1”,“ ABC5”和“ ABC8”的单词时,使用哪个精确命令?
  1. grep“ ABC [0-9]” <文件名>

  2. grep“ ABC(0-9)” <文件名>

  3. grep“ ABC(0-9)” <文件名>

  4. grep“ ABC(0-9)” <文件名>

答案与解释

正确答案:1
grep“ ABC [0-9]” <文件名>

第一个选项是正确的。

14) Can we use regular expressions with awk command?
  1. Yes

  2. No

Answer & Explanation

Correct answer: 1
Yes

Yes, we can use regular expressions with awk command.

14)我们可以在awk命令中使用正则表达式吗?
  1. 没有

答案与解释

正确答案:1

是的,我们可以在awk命令中使用正则表达式。

15) Which of the following command is used to display only directories that exist in the current directory?
  1. ls –l | grep "^d"

  2. ls | grep "^d"

  3. ls –l | grep "#d"

  4. ls –l | grep "*d"

Answer & Explanation

Correct answer: 1
ls –l | grep "^d"

The 1st command is correct.

15)以下哪个命令仅用于显示当前目录中存在的目录?
  1. ls –l | grep“ ^ d”

  2. ls | grep“ ^ d”

  3. ls –l | grep“ #d”

  4. ls –l | grep“ * d”

答案与解释

正确答案:1
ls –l | grep“ ^ d”

第一个命令是正确的。

16) Which of the following command is used to rename the file names that contain “text” with “txt” in the current directory?
  1. rename 'r/txt/text' *

  2. rename 'e/text/txt' *

  3. rename 's/txt/text' *

  4. rename 's/text/txt' *

Answer & Explanation

Correct answer: 4
rename 's/text/txt' *

16)使用以下哪个命令来重命名当前目录中包含“文本”和“ txt”的文件名?
  1. 重命名'r / txt / text'*

  2. 重命名'e / text / txt'*

  3. 重命名's / txt / text'*

  4. 重命名's / text / txt'*

答案与解释

正确答案:4
重命名's / text / txt'*

17) Which of the following command is used to replace the specific word, for example we want to replace inclusion by exclusion?
  1. echo inclusion | sed 's/in/ex'

  2. echo inclusion | sed 's/ex/in'

  3. echo inclusion | sed 'r/in/ex'

  4. echo inclusion | sed 'R/in/ex'

Answer & Explanation

Correct answer: 1
echo inclusion | sed 's/in/ex'

The 1st command is correct to replace the specific word.

17)以下哪个命令用于替换特定单词,例如我们要用排除来替换包含?
  1. 回声包含| sed's / in / ex'

  2. 回声包含| sed's / ex / in'

  3. 回声包含| sed'r / in / ex'

  4. 回声包含| sed'R / in / ex'

答案与解释

正确答案:1
回声包含| sed's / in / ex'

第一个命令正确地替换了特定的单词。

18) Why the double ampersands are used in a regular expression?
  1. The double ampersands (&&) are used in regular expression for deleting the specified string.

  2. The double ampersands (&&) are used in regular expression for replacing the specified string.

  3. The double ampersands (&&) are used in regular expression for searching the specified string.

  4. None of the above

Answer & Explanation

Correct answer: 3
The double ampersands (&&) are used in regular expression for searching the specified string.

18)为什么在正则表达式中使用双“&”号?
  1. 在正则表达式中使用双与号(&&)删除指定的字符串。

  2. 在正则表达式中使用双与号(&&)替换指定的字符串。

  3. 双与号(&&)在正则表达式中用于搜索指定的字符串。

  4. 以上都不是

答案与解释

正确答案:3
双与号(&&)在正则表达式中用于搜索指定的字符串。

19) Which of the following symbol is used to match the empty string at the beginning of a word?
  1. \<

  2. \%

  3. \$

  4. \(

Answer & Explanation

Correct answer: 1
\%

The \< is used to match the empty string at the beginning of a word.

19)以下哪个符号与单词开头的空字符串匹配?
  1. \ <

  2. \%

  3. \ $

  4. \(

答案与解释

正确答案:1
\%

\ <用于匹配单词开头的空字符串。

20) Can we use regular expressions in VI editor?
  1. Yes

  2. No

Answer & Explanation

Correct answer: 1
Yes

Yes, we can use regular expressions in VI editor.

20)我们可以在VI编辑器中使用正则表达式吗?
  1. 没有

答案与解释

正确答案:1

是的,我们可以在VI编辑器中使用正则表达式。

翻译自: https://www.includehelp.com/linux/regular-expressions-aptitude-questions-and-answers.aspx

linux正则表达式函数式

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值