grep can't open error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep can't open error
# 8  
Old 06-30-2010
Your quotes are fine

Is "filename" in your current directory? If not, you may not want to split the unqualified filename out. grep doesn't mind a fully qualified file name.

Try removing these lines:

Code:
        @a=split "/",$output;
        $output=$a[4];

Everything else looks perfect.

Last edited by Franklin52; 07-07-2010 at 06:30 AM.. Reason: Please use code tags
# 9  
Old 07-01-2010
grep can't open error ----- Continues

Hi,

If I understand you right....You wanted me to give the full path to the file rather than just the file name. But no luck.

Any other ideas or things that might cause this.

I am new to perl and I need to complete this by Tuesday.

Thanks
nurani
# 10  
Old 07-02-2010
I think this is the fix

chomp($output);

Since $output was the last field in the record you split, the newline is probably still attached as part of the filename (yes, a newline can be part of a filename.) The actual file name you're interested does not contain the newline. "filename\n" is quite a bit different than "filename". This is 97% guaranteed to work.
# 11  
Old 07-06-2010
Bug grep can't open error ----- Continues

Hi,

I have tried everything that has been suggested, but to no avail. Let me explain exactly what I am doing. (Or what I want the script to do)

1) I run my script in machine A
2) I need to grep the log files for "Number of orders processed". But these log files are sitting in machine B.

So, I am using the remsh command in a foreach loop to scan all the machines.

Once I find the log file, I am doing the Grep. My Grep is given below

Code:
grep "Number of jobs processed:" $output | sort -u | awk '{print $5}'`;

Any other suggestions that you can think of. I need to have this resolved by Tomorrow (Wednesday). Any help is very much appreciated.

Thanks
nurani
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Error when using vim to open files

Hi all, 1st post here. I'm on Solaris and currently, I get the following error if I try to use vim to edit anything: Error detected while processing function <SNR>6_initialize: line 2: E697: Missing end of List ']': E116: Invalid arguments for function <SNR>6_defineOption line 3: E10:... (6 Replies)
Discussion started by: fred2028
6 Replies

2. Shell Programming and Scripting

Awk: can't open error

Hi , In a directory i've the files in the following format pay:year:mon:11789604 pay:year:mon:17675644 --- and i need to get 4th part of the above file name so i used awk command in the below code #!/bin/ksh for test_data in pay* do txt_awk = awk -F':' '{print $4;}' $test_data ... (7 Replies)
Discussion started by: smile689
7 Replies

3. Emergency UNIX and Linux Support

Error when trying to start open office

Hi all I am receivng following error while running openoffice on linux system Please suggest and linux comman which can remove this error: (I) x.org loaded video driver of... (II) Loading /usr/lib64/xorg/modules/drivers/intel_drv.so (==) Depth 24 pixmap format is 32 bpp (III) ... (2 Replies)
Discussion started by: manigrover
2 Replies

4. Shell Programming and Scripting

Perl - Grep open file more then once.

Hi, I am using File::Find to go through a very large tree. I am looking for all xml files and open only those that contain a tag <Updated>. I then want to capture the contents of two tags <Old> and <New>. My problem is, after I open the file and do the first grep for <Updated> (which does... (3 Replies)
Discussion started by: OldGaf
3 Replies

5. Linux

ssmtp error : Cannot open <ip_address>:25

Hello, I am facing a problem with ssmtp mailing agent. I have installed and configured ssmtp in my RHEL5.3 system. I have written a shell script which sends mail to a couple of email id's. The script uses ssmtp to send mails. When I am running the scipt manually i.e. sh <script_name>.sh then... (3 Replies)
Discussion started by: senrooy
3 Replies

6. Red Hat

Error: Can't open display: :0.0

Hi, I get errors while running xclock from a non root user: # xclock --- this works fine # su - girish $ DISPLAY=:0.0; export DISPLAY $ xclock Xlib: connection to ":0.0" refused by server Xlib: No protocol specified Error: Can't open display: :0.0 $ I basically want to... (4 Replies)
Discussion started by: girish1428
4 Replies

7. Shell Programming and Scripting

grep: can't open /usr/dict/words

Hi All, If I use the "/usr/dict/words" inside the shell script, It is showing the error as, grep: can't open /usr/dict/words How can we resolve it? Thanks & Regards, Raja (2 Replies)
Discussion started by: Rajakct84
2 Replies

8. Shell Programming and Scripting

How to open an url and grep for a word

Hi All, I am new to shell scripting,Could any of you help me on this below :confused: -------------------- I need to write a shell script where i have open an url and grep for a particular word in the url and want to display it in a flatfile. Eg: Want to open yahoo.com and grep for yahoo... (1 Reply)
Discussion started by: sumithra
1 Replies

9. UNIX for Advanced & Expert Users

getting error when open vi editor

helo I install my product for koren language I m uisng RHEL -4 operating system now problem is whenever I open any file vi filename I got following error on the screen E557: Cannot open termcap file 'vt100' not known. Available builtin terminals are: builtin_ansi ... (1 Reply)
Discussion started by: amitpansuria
1 Replies

10. UNIX for Dummies Questions & Answers

cannot open error

Hi, Iam facing following error.please see the below script and error.Iam unable to attach error message to mail and its not sending mail also. vi Expedites_test.ksh "Expedites_test.ksh" 49 lines, 2276 characters #!/bin/ksh... (4 Replies)
Discussion started by: venu_cisco
4 Replies
Login or Register to Ask a Question