On Monday, July 22, 2002, at 10:21 , kent ho wrote:
> Hi All, > Just a generic "sed" question, please help. > > How do I pass a variable to this sed command: > > MONTH="Mar" > sed '/$MONTH/,$d' foo > foo.new #!/bin/sh d="231" MONTH="Mar" sed '/'$MONTH'/,$d' foo > foo.new the "'" single-quotes normally are used to 'hide' stuff from the shell interpretting it, so you merely need to 'un-hide' the variable from the shell.... oye, that took a moment, to note the silly in the syntax there - since you are saying from the line that Matches $MONTH to the end delete... had you wanted to have all lines from the beginning till you saw that token then you could have tried sed '/'$MONTH'/q' file hence telling it to quit when it sees that match. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]