1

I would like this command to print a dash if grep not found (in addition to the new line already coded):

while read vl ; do grep -w "$vl" APL_vs_HS.tab || printf "\n" ; done < 1

Thanks! Bernardo

1
  • 1
    By "grep not found", do you mean that the grep command doesn't exist, or that grep doesn't find the pattern? I presume the latter, but the way you phrased it implies the former. Commented Dec 19, 2013 at 17:07

2 Answers 2

5

Why do you need to use printf? Simply use echo, then you won't need to worry about printing a newline because echo automatically outputs one.

while read vl ; do grep -w "$vl" APL_vs_HS.tab || echo "-" ; done < 1
Sign up to request clarification or add additional context in comments.

Comments

4

See this, so that one would do

while read vl; do grep -w "$vl" APL_vs_HS.tab || printf -- "-\n" ; done < 1

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.