LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-24-2008, 08:56 PM   #1
lambchops468
Member
 
Registered: Mar 2007
Location: New Jersey, USA
Distribution: Archlinux
Posts: 165

Rep: Reputation: 30
[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?

Last edited by lambchops468; 03-24-2008 at 09:09 PM.
 
Old 03-24-2008, 09:00 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,962
Blog Entries: 11

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


Cheers,
Tink
 
Old 03-24-2008, 09:06 PM   #3
lambchops468
Member
 
Registered: Mar 2007
Location: New Jersey, USA
Distribution: Archlinux
Posts: 165

Original Poster
Rep: Reputation: 30
Smile

Quote:
Originally Posted by Tinkster View Post
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.
 
Old 03-24-2008, 09:19 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,962
Blog Entries: 11

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

Cheers,
Tink
 
  


Reply

Tags
expression, grep, line, matching, period, regex, regular


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash replace all matches of regex substring in string nickleus Linux - General 3 04-30-2011 11:08 AM
regex in ls vs. grep jhwilliams Linux - Software 2 08-10-2007 10:14 PM
egrep/grep regex question buldir Programming 7 05-08-2006 07:17 PM
Regex Question: Only print part of line that matches TheMeteorPolice Programming 5 01-12-2006 01:21 PM
grep (possibly regex) question. mwtheobald Linux - Newbie 1 08-17-2002 03:05 PM


All times are GMT -5. The time now is 06:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration