Find the answer to your Linux question:
Results 1 to 4 of 4
Hello all I am trying to find out line which contains filex , where x in an intezer for example vi test file1 abc ghdy file3 dhyd file4 file5 hdhd ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Location
    India
    Posts
    45

    regular expression + grep


    Hello all

    I am trying to find out line which contains filex , where x in an intezer
    for example
    vi test
    file1 abc ghdy file3
    dhyd file4 file5
    hdhd file
    jfujf jfj
    in order to find the lines containg filex i am using grep command

    grep file[1234567890] text

    but the command is not working? what is wrong with this command ??

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,382
    try this
    Code:
    egrep 'file[0-9]{1,1}' test
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Dec 2010
    Location
    India
    Posts
    45
    yes thank you

  4. #4
    Just Joined!
    Join Date
    Dec 2010
    Location
    India
    Posts
    45
    this is even working with
    grep 'file[1-9]' *

    i missed the quotes .

Posting Permissions

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