LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   grep regex . matches new lines?! (https://www.linuxquestions.org/questions/linux-newbie-8/grep-regex-matches-new-lines-630361/)

lambchops468 03-24-2008 08:56 PM

[solved] grep regex . matches new lines?!
 
n00b question here heh...
I'm following this tutorial:
http://www.panix.com/~elflord/unix/grep.html

and in the example
Quote:

>cat file
big
bad bug
bag
bigger
boogy

Wildcards #1
>grep "b.*g" file
big
bad bug
bag
bigger
boogy

Wildcards #2
>grep "b.*g." file
bigger
boogy

repetition
>grep "ggg*" file
bigger
my computer does not return the expect result for Wildcards #2:
Quote:

grep "b.*g." file
big
bad bug
bag
bigger
boogy
then i made a file with many lines (no characters) and grep'ed it for ".", and came back with all the lines
can someone tell me how to turn this period-matching-new-line off?

Tinkster 03-24-2008 09:00 PM

I'm surprised ... are you producing your files on Windows, by
any chance?


Cheers,
Tink

lambchops468 03-24-2008 09:06 PM

Quote:

Originally Posted by Tinkster (Post 3099344)
I'm surprised ... are you producing your files on Windows, by
any chance?


Cheers,
Tink

hahahaha
my vim is set up to save files with dos end of lines... (because i move lots of text files to school, where they have Windows boxes).

thank you very much for helping me.

Tinkster 03-24-2008 09:19 PM

Heh. Glad I could nudge you in the right direction ;}
Go forth and sin no more! :D

Cheers,
Tink


All times are GMT -5. The time now is 09:22 AM.