Find the answer to your Linux question:
Results 1 to 2 of 2
I want to search a string with grep command that print every line that the file 'whois.sh' with the symbol '&', followed by the string 'whois' followed by a '.', ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2011
    Posts
    1

    Problem with "grep" command


    I want to search a string with grep command that print every line that the file 'whois.sh' with the symbol '&', followed by the string 'whois' followed by a '.', then four other characters, followed by another a '.', followed by one or more characters, followed by ';;', followed by the end of the line.

    I have given following command

    egrep '&whois\..+\..+;;$' whois.sh

    and its working. but I am unable to select 4 charachters followed by '.' character.
    the command should be like this

    grep -E '&whois\..{4}\..+;;$' whois.sh

    but for me its not working. tell me its solution.

  2. #2
    Just Joined!
    Join Date
    Dec 2011
    Posts
    2
    Can you please post me a sample output of first Command "egrep '&whois\..+\..+;;$' whois.sh"

    Can also try with grep -E "&whois\..{4}\..+;;$" whois.sh

    If you want to know more on grep u can Check ou the below linux.
    http: // howtouselinuxcommand.blogspot.com/2011/12/grep-linux-command.html

Posting Permissions

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