How to search for partial words?

QuestionsQuestions4 SkillsProUser Account ManagementNov, 15 2025
0149

To search for partial words using grep, you can simply omit the -w option. This allows grep to match any occurrence of the specified pattern, regardless of whether it is a whole word or part of a larger word.

For example, if you want to search for the partial word "jok" in the /etc/passwd file, you would use the following command:

grep 'jok' /etc/passwd

This command will return any lines in the /etc/passwd file that contain "jok" as part of a word, such as "joker" or "joking".

0 Comments

no data
Be the first to share your comment!