Problem with grep opening a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with grep opening a file
# 1  
Old 10-25-2012
Problem with grep opening a file

Hello All,
Here is my silly question on grep..
Here is my code..

Code:
DAY=$(date --date="yesterday" +%y.%m.%d)

check "grep -h ' 404 ' /home/sathya/SystemOut.log /home/sathya/SystemOut_${DAY}*.log "

Where check is alias which makes to run this command in all my Servers[created with ssh and public keys].

When I execute the above statement, I receive the error that grep : cannot open the file.

Here is my debug output

Code:
+ + check_lvnodes grep -h ' 404 ' /home/sathya/SystemOut.log  /home/sathya/SystemOut_12.10.24_*.log

grep: 0652-033 Cannot open /home/sathya/SystemOut_12.10.24_*.log.

Where as it grep the pattern in SystemOut.log . Also the SystemOut_12.10.24_*.log are present in the specified directory..

Code:
SystemOut_12.10.24_03.03.52.log  SystemOut_12.10.24_04.15.24.log  SystemOut_12.10.24_06.01.35.log


I am missing something here, please shout me on what am i missing
# 2  
Old 10-25-2012
Code:
check "grep -h ' 404 ' /home/sathya/SystemOut.log /home/sathya/SystemOut_${DAY}*.log "

"*" is loosing its special value since its inside the double quotes...try a workaround on this...
# 3  
Old 10-25-2012
Thanks msabhi, i found out another way

Code:
check 'find /home/sathya/ -name "SystemOut.log" -o -name "SystemOut_${DAY}*"|xargs grep -h " 404 "'

# 4  
Old 10-25-2012
cooool Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problem to grep contents from a file

hi, I'm trying to grep content from one file in another file. The file that I'm searching into is large and hence I need to temporarily unzip it first. gzip -dc ALL.chr2.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz | grep '169997024\|190670539\|128051369' >... (2 Replies)
Discussion started by: janshamsani
2 Replies

2. Shell Programming and Scripting

Xmllint - Xml-file problem --ods file not opening

Dear All, this is my first post on this Forum, glad to be here. I'm trying to fix an .ods file. Yes, I had a backup, but it's also corrupted. When opening the document I get this EM: read error format error discovered in the file in sub-document content.xml at 2,337040(row,col). So I... (3 Replies)
Discussion started by: jameslast
3 Replies

3. UNIX for Dummies Questions & Answers

Problem with grep from pattern file with if

I have two sets of data accept.txt is the list of 50 words Tom Anne James ... and I have a file01.txt which has the frequency of words which I got it using cat main.file | tr -d '' | tr ' ' '\n' | tr 'A-Z' 'a-z' | sort | uniq -c | sort -n -r > file01.txt so my file now looks like this... (2 Replies)
Discussion started by: A-V
2 Replies

4. Shell Programming and Scripting

Grep on zip file problem

Hi All, I'm stuck with this issue when I try to display the searched string into a compressed file. More exactly when I run this script for f1 in $(find dir1 -type f -print); do gunzip -c $f1 | grep -n "gio" | awk -F":" '{print $1-1 "," $1 "p"}' | xargs -i sed -n {} $f1 ; done returns... (3 Replies)
Discussion started by: gio1234
3 Replies

5. Programming

Problem in opening a file!

Hello All, I am new to programming in unix. I am trying to create a file by using open command. The entire file is : #include<fcntl.h> main(void){ int fd; fd = open("File1", O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR|S_IRWXO); printf("%d ", fd); } The problem I am facing a strange problem.... (2 Replies)
Discussion started by: vkn_1985
2 Replies

6. UNIX for Dummies Questions & Answers

Problem in opening UNIX file in Windows

Hi , I am having file in unix with size (386796649) , below is the output of ls command in UNIX. I have ftp'ed the file to my windows machine . When i tried to open the file it is not opening . Why it is so . Is there is size limit. -rw-rw-rw- 1 p10 pQQ 98473 Sep 17 17:20... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

7. IP Networking

problem opening TCP ports

Please can somebody help me. I'm trying to open ports 999, 1982 and 1983 but am not having much luck. I used iptables -A INPUT -i eth0 -p tcp --sport 999 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -A INPUT -i eth0 -p tcp --sport 1982 -m state --state NEW,ESTABLISHED -j ACCEPT iptables... (5 Replies)
Discussion started by: thehaapyappy
5 Replies

8. Shell Programming and Scripting

Getting Following problem when opening shell script (Very Urgent)

Hi All, Actually when i am trying to open my shell script file 1.sh then i am getting the following error. > vi 1.sh "/var/tmp/ExdNaarK" No space left on device Can anybody tell me that how to rectify it. It is very urgent. Because i am not able to do any work due to the above error. ... (1 Reply)
Discussion started by: sunitachoudhury
1 Replies

9. UNIX for Advanced & Expert Users

Problem Opening X-Clients in Solaris

Hi, I use hummingbird exceed9.0 to open active X-Server Sessions to Solaris(Sol9 SPARC) machines. I m able to open "Solaris desktops(CDE)" for all Solaris machines except a specific machine. Initially the XDMCP display manager chooser did not display (that) server in the list. I had to... (2 Replies)
Discussion started by: mahatma
2 Replies

10. AIX

Problem opening port 9998

Hi there, I have been trying to open port 9998 on an AIX 5.1 box to no avail. This machine is not connected to the internet and I have only been accessing it locally, so I know it's not a network firewall/proxy issue. I have tried editing /etc/services and inetd.conf, refreshing inetd.conf, and... (3 Replies)
Discussion started by: erica057
3 Replies
Login or Register to Ask a Question