In article <[EMAIL PROTECTED]>, Kent West <[EMAIL PROTECTED]> wrote: >A programmer would know this . . , but not me ;-) > >I'm using a script to build a file by concatenating portions of two >other files. Then end result needs to be checked to make sure a certain >word shows up in a line. > >I know that "grep programm <this email message>" would return the line: > > A programmer would know this . . , but not me ;-) > >but what I want returned is just the word "programmer".
sed -ne 's/^.*\(word_here\).*$/\1/p' < file BTW, why not simply if grep -q word file then # word was present in file bla bla fi Or "if ! grep -q word file" if you want to do something if word wasn't present in file. Mike. -- The question is, what is a "manamanap". The question is, who cares ? -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]