doing grep inside perl file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting doing grep inside perl file
# 1  
Old 09-08-2008
doing grep inside perl file

Hi have one Perl file inside that i am defining
at an array file.

@temp_vmdk_files = `grep vmdk '$guest_vmx'`

where my $guest_vmx=/vmfs/volumes/47e40fec-9c8bb7f7-d076-001422159f8a/BES Exchange/BES-Exchange.vmx

and i am just want to do grep of "vmdk" files from the above path
but when i execute this Perl file i am getting following error


"grep: /vmfs/volumes/47e40fec-9c8bb7f7-d076-001422159f8a/BES"

please let me know how to define the grep for the above thing

Thanks
# 2  
Old 09-08-2008
its issue with the value in the variable. there is a space in the directory name.
Quote:
BES Exchange
# 3  
Old 09-08-2008
so this cant be resolved?
# 4  
Old 09-08-2008
I cannot reproduce the problem here, the single quotes around the file name should already have fixed that. Also the error message looks incomplete. Is that really the whole message? Which platform is this?
# 5  
Old 09-08-2008
Quote:
Originally Posted by era
I cannot reproduce the problem here, the single quotes around the file name should already have fixed that. Also the error message looks incomplete. Is that really the whole message? Which platform is this?
Era, If you see the error, it just breaks at BES. Very likely that space is creating the issue.

"grep: /vmfs/volumes/47e40fec-9c8bb7f7-d076-001422159f8a/BES"
# 6  
Old 09-08-2008
I see that, but I don't get the same error message here when I try a similar script, and the error message from grep is incomplete. It should say something like "file not found" or something.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Source.cshrc file inside Perl

I have a file which is basically .cshrc It contains lines such as: setenv <variable> <value>... set path=(<dir> <dir>) source <another_file>... (1 Reply)
Discussion started by: kshitij
1 Replies

2. Shell Programming and Scripting

Search inside a file, PERL

HEllo!! I need a script in perl that see inside a file(file.txt) that has only one row. The row contains only this text: logs_yearly = 20120628113345 I want that the script does this: "Search in the file, if the date 20120628 is actual date" Thank you!! ---------- Post... (4 Replies)
Discussion started by: super_sun
4 Replies

3. 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

4. Shell Programming and Scripting

How to grep the contents inside a tar file

Hi All I have searched the possibility of this options everywhere but am unable to find it in any forum. I have a tar file inside which there are n number of files and i dont know them. I need to grep a word inside the tar file and need to know in which file the word resides. > cat a... (2 Replies)
Discussion started by: Whiteboard
2 Replies

5. Shell Programming and Scripting

Opening File names with spaces inside it !- PERL

I developed a perl code..And the excerpt from it is given below... open(HANDLE,$cmp_path) ; #reading the xml file from the file path while($file_path = <HANDLE>) I have list of XML files to read from a folder. It has some spaces inside the name of the file...I used "\"... (2 Replies)
Discussion started by: gameboy87
2 Replies

6. UNIX for Advanced & Expert Users

how to grep/read a file inside compressed tgz without extract?

Hi all, I would like to ask whether in Unix shell/perl have any functions or command to allow grep/cat/read a file inside compressed .tgz without extract it? I know we can tar tvf a compressed tgz but this only allow we read the path/filename contained inside the tarball. If we want to read... (3 Replies)
Discussion started by: mayshy
3 Replies

7. Shell Programming and Scripting

grep inside the zip file

i have to grep a particular pattern say "meter number" in 100s of zip files file1.zip : : : : file100.zip how to achive this? cat *.zip | grep "meter number" also i dnt want to unzip and then grep it...... hope i made myself clear. thanks in advance (5 Replies)
Discussion started by: ali560045
5 Replies

8. Shell Programming and Scripting

how to redirect the output of a grep command to a file inside a shell script

hi, i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (11 Replies)
Discussion started by: kripssmart
11 Replies

9. UNIX for Dummies Questions & Answers

how to get the output of a grep command to a file inside a shell script

hi, i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (1 Reply)
Discussion started by: kripssmart
1 Replies

10. Shell Programming and Scripting

grep ^M in file using perl script....

hi i am using perl on windows ( active state perl 5.8 ) and i want to check for Control-M (^M) in file. files to be checked are in unix format so new line character is (\n). This perl script is called from Batch file ( windows .BAT file ) my script is while (<PROGRAM>) { ... (12 Replies)
Discussion started by: zedex
12 Replies
Login or Register to Ask a Question