grep a single word...not two!
So if I use:
$<my command> | grep dim4 #I get to options: Output : dim4 42 pixdim4 1.0000000000 But I would like just the 'dim4 ' line to appear without the pixdim4 line....like this: $<my command> | grep dim4 #I want the output just with the first line: Output: dim4 42 How can i make it work? Thanks in advance! |
If dim is always at the beginning of the line try:
Code:
grep "^dim4" Code:
grep "\<dim4\>" |
try this
<my command> | grep -w 'dim4' |
You can try this too.
Code:
<my command> | grep "\bdim4" |
Quote:
Code:
$ <command> | head -n1 Code:
$ <command> | grep -w -m1 'dim4' |
No need to make it complecated. Just use -w option to grep some specific regexp. From manual of grep:
Quote:
Code:
~$ <my_command> | grep -w 'dim4' |
Great!!! The fist two posts worked :)
This post and you guys are great! |
All times are GMT -5. The time now is 08:56 PM. |