Welcome to the VirtuQ Forums.
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Jan 2012
    Location
    Allahabad
    Posts
    184

    Using . as regular expresion for finding some pattern

    Sir,

    In section 10.3 it is shown that, . matches single character except dot itself.
    But when i try this commnad in lab it matches the whole character .
    when i execute the command ls -l | grep .bz2 it matches exactly bz2 and show output.
    Question will be more clear by my attachment.

    Thanks
    Anon10087
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Untitled.jpg 
Views:	350 
Size:	15.8 KB 
ID:	40  
    Last edited by anup; 05-02-2012 at 11:02 AM.

  2. #2
    VirtuQ™ Moderator
    Join Date
    Jul 2011
    Location
    Bangalore, India
    Posts
    1,044
    Blog Entries
    2
    Anon10087,

    Good question as to why the '.' is matching a .bz2? You should try to put in more files there like cbz2, dbz2 etc. and then you will notice that it matches even these files. The reason is that a '.' will also match the NULL or empty character, which is what is happening in this case.

    Thanks,

    Anup


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •