Find the answer to your Linux question:
Results 1 to 4 of 4
Hello I wanna use grep in a bash script to return the exact match of my choice. eg: grep "[:space:][0-9]something[0-9][:space:]" myfile.txt This is rather a grep issue, though. However, I ...
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    2

    bash scripting

    Hello

    I wanna use grep in a bash script to return the exact match of my choice.

    eg:

    grep "[:space:][0-9]something[0-9][:space:]" myfile.txt

    This is rather a grep issue, though. However, I get lines including such a match. But I want the words that match my wildcard expression 'cos I wanna append it to another text file.

    Can someone help pls?

    DH

  2. #2
    Just Joined!
    Join Date
    Dec 2009
    Posts
    2
    sorry guys. my bad! i found the solution.

    apparently, it was easy.

  3. #3
    Just Joined!
    Join Date
    Jan 2005
    Posts
    17
    Quote Originally Posted by debianhead View Post
    Hello

    I wanna use grep in a bash script to return the exact match of my choice.

    eg:

    grep "[:space:][0-9]something[0-9][:space:]" myfile.txt

    This is rather a grep issue, though. However, I get lines including such a match. But I want the words that match my wildcard expression 'cos I wanna append it to another text file.

    Can someone help pls?

    DH
    Your question is not easy to understand. Could you explain further? I use bash with awk it it trims well.

  4. #4
    Just Joined!
    Join Date
    Jan 2008
    Posts
    53

    Question I think i understood

    Quote Originally Posted by ngwasuma View Post
    Your question is not easy to understand. Could you explain further? I use bash with awk it it trims well.
    I guess he was trying to use the regular expressions with grep, i do not know what he wanted to do, but he solved, it would be usefull if 'debianhead' post the solution. I think is a little selfish from debianhead to post a problem then solve it and at the end save the answer for it self.

Posting Permissions

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