Issues with grep -w


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Issues with grep -w
# 8  
Old 08-12-2009
rdhanek,

For time being you can use something like this :

Code:
awk -v e="$express" '$0 ~ e {print}' LOG.txt

I am not figuring out why the same is not working with "grep".
# 9  
Old 08-12-2009
Hi Panyam,

i don't think the issue is with grep, as i am getting the data if the else part of the code is executed.
The only issue is with first part of the code which i am using to get the yesterday's data, if the current time is less than 5 am.(as i njeed to get 5 hrs back data)
The first part also is printing the $ express correctly. There should an issue with the space somewhere which is causing ultimately grep not to pick any data.

Code:
if (( $stime < 5 ))
then
stime=`expr $stime \+ 18`
export express=`TZ=CST+24 date '+%m/%d/%Y'`\ $stime

# 10  
Old 08-12-2009
But the awk statement which i mentioned is working well in both the conditions. You can test that which is similar to grep only.
# 11  
Old 08-12-2009
panyam, i am getting a bailing out error with that awk command.
# 12  
Old 08-13-2009
The same working fine for me ..can you recheck what you have tried.
# 13  
Old 08-13-2009
Hi Panyam,

The awk statement is still giving me bailing out error. i am not sure if it is an issue because my box is SunOS.

Apart from this, the grep -w that you have suggested is working fine for both the instances finally.(it was not working for maual runs. I tried by cronning the script and it just worked fine. Not sure what was the issue when i run it manually. )

Thanks a lot for ur continuous support on This.
# 14  
Old 08-14-2009
For the awk solution to make it work , use nawk or gawk and try.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Echo and grep issues

Is there an environment issue that would not allow the following not store and pass the value into this field: underScorePresent=`echo $USER | grep "_" | wc -l` It is running on a new redhat 6.5 OS. The value $USER is set to cpac. It is a vendor code and they are saying it is environment... (1 Reply)
Discussion started by: mrn6430
1 Replies

2. Shell Programming and Scripting

Inconsistent `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`

i have this line of code that looks for the same file if it is currently running and returns the count. `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l` basically it is assigned to a variable ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies

3. UNIX for Dummies Questions & Answers

Piping grep into awk, read the next line using grep

Hi, I have a number of files containing the information below. """"" Fundallinfo 6.3950 14.9715 14.0482 """"" I would like to grep for Fundallinfo and use it to read the next line? I ideally would like to read the three numbers that follow in the next line and... (2 Replies)
Discussion started by: Paul Moghadam
2 Replies

4. UNIX for Dummies Questions & Answers

Issues while pattern matching using grep

Hi, I have a file f1 wi the following data f1.txt ======== Report ID Report Name ----------------------------------------------------------------- Post Requests : 2 Post successes : 2 ============================================= I need to search for the... (2 Replies)
Discussion started by: RP09
2 Replies

5. UNIX for Dummies Questions & Answers

Bash - CLI - grep - Passing result to grep through pipe

Hello. I want to get all modules which are loaded and which name are exactly 2 characters long and not more than 2 characters and begin with "nv" lsmod | (e)grep '^nv???????????? I want to get all modules which are loaded and which name begin with "nv" and are 2 to 7 characters long ... (1 Reply)
Discussion started by: jcdole
1 Replies

6. Shell Programming and Scripting

Issues in grep command in Linux

Hi All I have a file containing following records: $HEW_TGT_DB2_USER=hbme_bi2 $prmAttunityUser=ais $DS_USER=hbme_bi2 $prmStgUser=hbme_bi2 $prmuser=hbme_bi2 $prmStgPass=hbme_bi2 $prmpwd=hbme_bi2 $prmAttunityUser=ais Say suppose the name of the file is test4.txt When i fire this... (5 Replies)
Discussion started by: vee_789
5 Replies

7. Shell Programming and Scripting

grep for certain files using a file as input to grep and then move

Hi All, I need to grep few files which has words like the below in the file name , which i want to put it in a file and and grep for the files which contain these names and move it to a new directory , full file name -C20091210.1000-20091210.1100_SMGBSC3:1000... (2 Replies)
Discussion started by: anita07
2 Replies

8. UNIX for Dummies Questions & Answers

| help | unix | grep (GNU grep) 2.5.1 | advanced regex syntax

Hello, I'm working on unix with grep (GNU grep) 2.5.1. I'm going through some of the newer regex syntax using Regular Expression Reference - Advanced Syntax a guide. ls -aLl /bin | grep "\(x\)" Which works, just highlights 'x' where ever, when ever. I'm trying to to get (?:) to work but... (4 Replies)
Discussion started by: MykC
4 Replies

9. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

10. UNIX for Dummies Questions & Answers

GREP issues

Hi all, I am trying to perform a simple task with grep, this is what I execute: grep -i -n 'error|fail|warning' cl_less.out when I execute it it does not give any errors, as in the command worked and back to the command prompt, but if I run each grep independently the I do get a real fail: ... (8 Replies)
Discussion started by: sqloyd
8 Replies
Login or Register to Ask a Question