0

When I run the grep command on the command prompt, the output is correct. However, when I run it as part of a script, I only get partial output. Does anyone know what is wrong with this programme?

#!/bin/csh
set res = `grep -E "OPEN *(OUTPUT|INPUT|I-O|EXTEND)" ~/work/lst/TXT12UPD.lst`
echo $res
Programmer
  • 6,565
  • 25
  • 78
  • 125

1 Answers1

0

Your wildcard is probably being processed by the shell calling awk rather than as part of the awk script.

try escaping the * with a \ (i.e. \*)

John3136
  • 28,809
  • 4
  • 51
  • 69
  • I also tried set res = `grep -E 'OPEN \*(OUTPUT|INPUT|I-O|EXTEND)' ~/work/lst/TXT12UPD.lst` – Programmer Nov 29 '13 at 03:33
  • You may need 2 backslashes - one for the shell running the command and one for the backticks – John3136 Nov 29 '13 at 03:46
  • please stop guessing like this. Can you try on your end and let me know. IT is just wasting my time. – Programmer Nov 29 '13 at 04:16
  • I notice your duplicate question uses single quotes instead of double - made your mind up yet? You have a problem with wildcards. You just need to figure it out! – John3136 Nov 29 '13 at 04:18