Saturday, 15 June 2013

Git Bash - find words in a file (or string) matching specified sub-string -



Git Bash - find words in a file (or string) matching specified sub-string -

cmd: cat test.txt | grep pin results: prints lines containing pin

i want grep words containing pin. command that?

thanks!

all, give thanks comments. using git bash (version 1.9.4). grep in shell not have -o option. there -w option. tried: grep -w 'pin' test.txt returns nothing.

anyone using git bash solve issue?

thank all.

assuming file called test.txt, can do:

grep -o '\s*pin\s*' test.txt

the -o flag print matching words on line, opposed whole line.

bash word

No comments:

Post a Comment