pokemon blue
pokemon blue

Reputation: 1880

How to grep lines with specific words, starting either with multiple spaces or tabs?

these are possible use cases, different samples of line from a file. These lines would be containing only one checkWord.

> checkWord
>     checkWord
>    checkWord
> <tab>   <tab> checkWord
> <tab>checkWord
> checkWord<tab>

how to grep all such cases?

Upvotes: 0

Views: 637

Answers (1)

anubhava
anubhava

Reputation: 785246

You can grep using:

grep '^[[:blank:]]*checkWord'

^[[:blank:]]* matches 0 or more space or tab characters at the start of line.

Upvotes: 1

Related Questions