Filtering out comments from COBOL programs

In SCO Unix, I have a working script to give me a list of COBOL (files end in .cbl) programs containing a specific variable ($1) on a line which is not a comment. The output of the first grep will be the full path to a file, a colon, and the contents of the line where this variable is found.

The usual way to comment a line is to place an asterisk() in column 7 so a grep which excludes a colon, six characters which could be anything, and an asterisk works. I am trying to take out a type of comment starting with spaces or tabs followed by ">" but thus far, no progress.

grep $1 /u/dir1/cobsrc/cpy/*.cbl | grep -v ":......\*" |\
   grep -v -E ":[  ]*\*>" >>/usr/tmp/a.x$tstamp

I am trying to insert the "grep -v -E" and the bracket contains a space and a tab. This new grep doesn't filter out anything.

The script ends when a sed reads the temporary file and takes out the colon and everything that follows it which is then passed to sort -u.

TIA

Let me bring attention to the highlighted parts.'
":[ ]*\*>" A colon `:' followed by either one or more space or space, followed by a literal `*' followed by a `>'. That's not what you described and I highlighted.

Maybe, grep -v -E '[[:space:]]*\*>'

Hi.

Omitting sample input and output will probably decrease the likelihood of responders even looking at your problem.

Best wishes ... cheers, drl

To get the best advice on transforming, extracting, manipulating data,
please supply your computing environment and problem context:

1. OS and shell, preferably with versions
2. Representative sample input
3. Output desired that corresponds to the input
4. Logic to obtain output from input
5. Attempts at a solution that you have tried, including output

Post code and data inside CODE tags.

If you need to use or to avoid certain tools, you may need
to explain why, especially if your post count is low. Once the
problem is identified, responders often can choose the most
appropriate tool, not necessarily the one you might want.

These guidelines allow responders to create solutions without
ambiguity and to avoid creating sample data sets.

I got it to fly by putting a space followed by a tab inside the "[]". Some dummy test files had various combinations of space(s) and tab(s) in front of "*>", and these did not show up.

Thanks for looking at it.
Resolved.