Grep reg. express problem


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Grep reg. express problem
# 1  
Old 03-28-2014
Grep reg. express problem

When in the vi editor, I can find where the value of variables in COBOL programs (everything is uppercase) get changed with
Code:
/[NOTEP][EGMOT]  *ACCT-BALANCE

and it will find the last two characters of reserved words such as ACCEPT, FROM, TO, and COMPUTE followed by at least one space before the variable I'm looking for.
Running something similar through grep such as
Code:
grep "[NOTEP][EGMOT]  *ACCT-BALANCE" *.CBL

would display all occurrences of ACCT-BALANCE with or without a keyword or leading space (BACCT-BALANCE for example). In both cases, there are two spaces before the asterisk.

What am I missing?

TIA
# 2  
Old 03-28-2014
I cannot reproduce this. Your grep seems to works OK. Could you post a sample?
This User Gave Thanks to Scrutinizer For This Post:
# 3  
Old 03-28-2014
Sorry, I couldn't reproduce it either. It displayed every line containing the field name regardless of leading keywords or something other than a space in front of it but I can't find the grep command I used, it rolled off the screen.

At any rate, thanks for looking at it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies

2. UNIX for Dummies Questions & Answers

Grep Problem

Dear all, my question is about grep. i have two files. the first one is a list with ids (line number 188) like this: comp10045_c0_seq1 comp10118_c0_seq1 comp10221_c0_seq2 comp10503_c0_seq1 comp10504_c0_seq1 comp10504_c0_seq2 comp10631_c0_seq1 comp10631_c0_seq2 comp10646_c0_seq1... (17 Replies)
Discussion started by: kleinstadt
17 Replies

3. Shell Programming and Scripting

Grep problem

i have a log file...in that there is a data like oss1 F:\app\data\misc\server 012-07-31 08:35:15 8.1.1. oss2 F:\app\data\misc\server 012-07-31 08:36:15 8.1.2. oss3 F:\app\data\misc\server 012-07-31 08:37:15 8.1.3. pss4 F:\app\data\misc\server 012-07-31... (20 Replies)
Discussion started by: navsan420
20 Replies

4. UNIX for Advanced & Expert Users

reg problem deleting file

hi, 1. When i am deleting file in the linux machine i am getting below error message. rm text.fil rm: remove regular file `text.fil'? y rm: cannot remove `text.fil': Read-only file system From su also i tried i am getting same error message. 2. Some times the file permissions and user name... (1 Reply)
Discussion started by: coconut.ramu
1 Replies

5. Shell Programming and Scripting

Awk problem: How to express the backtick(')

For example: I got a list of file end at .txt. I want all of them do the same command like grep '^@' and attached it to a output .sh file. This is the command I type: ls *.txt | awk '{print "grep \' \^\@\' ",$1}' > txt.sh My desired output is when I type the command "more txt.sh " The... (4 Replies)
Discussion started by: patrick87
4 Replies

6. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

7. Shell Programming and Scripting

HowTo: reg expr doing grep "timestamp>$DesiredTime" logfile ?

I know I asked a similar question but I want to know if there is a regular expression existing that with a korn shell cmd, finds any timestamp data records in a file where it is greater then a timestamp in a shell variable ? something like : grep all records where it has a timestamp >... (5 Replies)
Discussion started by: Browser_ice
5 Replies

8. UNIX for Dummies Questions & Answers

reg putty problem

Hi, i am using PUTTY 0.51 release for connecting the Red hate linux box in SSH mode. its working fine but i can't able to scoll the scoll bar using scroll wheel inthe mouse. please suggest me how to solve it. thanks in advance. thanks and regards, ilayans (2 Replies)
Discussion started by: ilayans
2 Replies

9. Shell Programming and Scripting

grep problem

cat *:22:B0 has the following output 2220 -50 2220 -50 2220 -51 2225 -47 2225 -50 2230 -63 2230 -50 2235 -50 2235 -50 2235 -48 2240 -53 2240 -53 2245 -51 2245 -51 2250 -52 2250 -52 2250 -50 (2 Replies)
Discussion started by: yogesh_powar
2 Replies

10. UNIX for Advanced & Expert Users

SCO vs Linux Reg Expressions Problem

Hi there, I'm investigating migrating a system currently running Scos osr5 to Linux (eg RH 7.2) but there are a lot of in house scripts, some of which are probably using "Sco specific" constructs etc. One I have come across is as follows, if ????? ] then ....etc.etc fi The regular... (2 Replies)
Discussion started by: pcs7088
2 Replies
Login or Register to Ask a Question