seraching for string containing $ in grep

From: John Dunn (jdunn_at_sefas.com)
Date: 05/04/05

  • Next message: Green, Simon: "Re: what is your way in the future when PSSP runs out of support?"
    Date:         Wed, 4 May 2005 10:40:19 +0100
    To: aix-l@Princeton.EDU
    
    

    I have a script containing the following grep command(which searches a file
    for the $SEARCH value, ignoring the first 8 characters in each line).

    However I am having problems in that sometimes the string to search for can
    begin with a $ sign, e.g. $SEARCH can contain $JOHN

    I cannot get the script to work in this case. Any ideas?

    SEARCH=$1
    DIR=$2
    FILE=$3

    grep -E "^.{8,8}.*$SEARCH" $DIR/$FILE


  • Next message: Green, Simon: "Re: what is your way in the future when PSSP runs out of support?"

    Relevant Pages

    • Re: Piping within for-loops
      ... > I want to write a script, that selects words from a wordlist, ... > which don't contain certain characters, ... > lists all words that don't contain the letters a, ... Use a character class in grep, ...
      (comp.unix.shell)
    • grep and dollar sign
      ... I have a script containing the following grep command(which searches a ... ignoring the first 8 characters in each ... I cannot get the script to work in this case. ...
      (comp.unix.shell)
    • Re: Grep and cut removing spaces
      ... > I'm using grep and cut to extract 30 characters from a file. ... > the script runs, ...
      (comp.unix.shell)
    • Re: FWIW: ST Enterprise Cancelled
      ... > through the Guardian while they were playing with it. ... Where in any version of Ellison's script is this? ... LeBeque tells Beckwith that hes not going to keep doing ... >>will not do with their continuing characters and overall storyline, ...
      (sci.space.history)
    • Re: Find a line in a text file then print a field
      ... Here is "grep" part of my perl script so far (ommitting the various ... the matching lines in an array. ...
      (perl.beginners)