Ask Your Question

I want to grep for "```*" in a File, in other Words: "```" followed by any Word

asked 2023-04-11 12:36:15 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-04-11 12:36:59 +0000

qstack gravatar image

To extend the grep command to search for lines containing the pattern "```" followed by any word, you can use the following command:

grep -E '```[[:alnum:]]+' your_file.txt

Here's the breakdown of the command:

grep: The command itself -E: Tells grep to use extended regular expressions '[[:alnum:]]+': The pattern you're looking for : Matches the three backticks +: Matches one or more occurrences of the preceding character class your_file.txt: The file you want to search in (replace this with the actual filename) This command will match lines containing "" followed by one or more alphanumeric characters. If you want to include other characters like underscores, you can modify the character class, for example: '[_[:alnum:]]+'.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools

1 follower


Asked: 2023-04-11 12:36:15 +0000

Seen: 26 times

Last updated: Apr 11 '23