Sponsored Content
Top Forums Shell Programming and Scripting Filtering out comments from COBOL programs Post 302997287 by Aia on Wednesday 10th of May 2017 06:06:29 PM
Old 05-10-2017
Quote:
Originally Posted by wbport
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.
Code:
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:]]*\*>'
 

10 More Discussions You Might Find Interesting

1. Gentoo

COBOL on linux?!

Hello guys, I'm searching for a good COBOL compiler which runs on linux. In fact I have found one but I'm really lost with its installation!! I don't know how to install it and how it works. In fact I'm not so good in linux and I always have problems with installation, but this time it's... (1 Reply)
Discussion started by: HSN
1 Replies

2. Solaris

COBOL issue

Hi, I am working on a Mainframe to UNIX replatforming project. we are facing problems with COBOL COMP-3 fields. We are using the Mainframe emulator software to download the data which has COMP-3 fields and using it as input to the same COBOL programs which were copied from Mainframe and did the... (1 Reply)
Discussion started by: Jayaprakash T
1 Replies

3. UNIX and Linux Applications

Rm-cobol 85

Does anyone use the following Cobol compiler: RM/COBOL-85 Compiler - Version 5.15.00 for SCO Unix 386. I am looking for a file that might be part of the distribution named "osmain.o" Thanks. (0 Replies)
Discussion started by: jgt
0 Replies

4. Programming

cobol crn programme run on express cobol as .gnt

can i run .crn programme in express cobol which support to .gnt programme .... Plz tell me solution (2 Replies)
Discussion started by: bibi
2 Replies

5. Shell Programming and Scripting

Calling script from RM cobol and returning value to cobol

Is there a way you can return a value from a script that is called from a rm cobol program... 01 WS-COMD-LINE-PGM X(39) value sh ./getUserId.sh 12345" 01 WS-RETURN-SYS-CODE PIC 9(8). CALL "SYSTEM" USING WS-COMD-LINE-PGM GIVING WS-RETURN-SYS-CODE. ... (1 Reply)
Discussion started by: pavanmp
1 Replies

6. SCO

cobol installation

Dear All, while installing mfcobol in sco open unix 5 in piv m/cs, when run #sh ./install this error massage is comming load error file lmfnewdb error code 198 pc=0 call=-1 seg=0 198 load failor chmod warrning can not acess /opt/lib/mflmf/mflmfdb no such file or directory (error-2)... (0 Replies)
Discussion started by: sudhir69
0 Replies

7. UNIX for Dummies Questions & Answers

Are programs like sys_open( ) ,sys_read( ) et al examples of system level programs ?

Are the programs written on schedulers ,thread library , process management, memory management, et al called systems programs ? How are they different from the programs that implement functions like open() , printf() , scanf() , read() .. they have a prefix sys_open, sys_close, sys_read etc , right... (1 Reply)
Discussion started by: vishwamitra
1 Replies

8. Shell Programming and Scripting

Sed script, changing all C-comments to C++-comments

I must write a script to change all C++ like comments: // this is a comment to this one /* this is a comment */ How to do it by sed? With file: #include <cstdio> using namespace std; //one // two int main() { printf("Example"); // three }//four the result should be: (2 Replies)
Discussion started by: black_hawk
2 Replies

9. What is on Your Mind?

How safe is Dropbox and Ubuntu one? Would you store critical files or programs there? Any comments o

How safe is Dropbox and Ubuntu one? Would you store critical files or programs there? Any comments on the guarantee that the two companies provide and on the technology used for encryption? (1 Reply)
Discussion started by: frad
1 Replies

10. UNIX for Dummies Questions & Answers

Difference between inbuilt suid programs and user defined root suid programs under bash shell?

Hey guys, Suppose i run passwd via bash shell. It is a suid program, which temporarily runs as root(owner) and modifies the user entries. However, when i write a C file and give 4755 permission and root ownership to the 'a.out' file , it doesn't run as root in bash shell. I verified this by... (2 Replies)
Discussion started by: syncmaster
2 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 08:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy