file search containing string

2007-09-24 Thread Nishi Bhonsle
Hi: How can I use perl to do the following - --Look for a file on a filesystem containing a string such as "Product Name 1.0.0.0.0" --Then get the disk location path of the file and store the path in a variable. --Pass the variable to an external java program. Thanks a lot! -- To unsubscribe,

substring of a string delimited by "/"

2007-05-11 Thread Nishi
Hi: I have a string of the format - abc/def/ghi or abc\def\ghi I want to strip of abc and return just def/ghi or def\ghi How do I do that? Thanks!

Re: basename equivalent?

2007-04-27 Thread Nishi
I thing that I forgot to mention here is that I am calling the perl commands within a batch script. So I pass ACTIVESTATEPERL to the perl within the batch script and the bat file is run within the cygwin environment. Thanks, Nishi. On 4/27/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 4

Re: basename equivalent?

2007-04-27 Thread Nishi
So, calling the perl script explicitly as in %ACTIVESTATEPERL%\bin\perl.exe solves my issue in the cygwin environment. On 4/27/07, Nishi <[EMAIL PROTECTED]> wrote: So, I see the below output (that is diff than yours) when i run from cygwin. If I run from the cmd prompt, I see th

Re: basename equivalent?

2007-04-27 Thread Nishi
So, I see the below output (that is diff than yours) when i run from cygwin. If I run from the cmd prompt, I see the same output as yours. On 4/27/07, Nishi <[EMAIL PROTECTED]> wrote: This is what i see c:\foo\bar\baz.txt -> c:\foo\bar\baz.txt /cygdrive/c/foo/bar/baz.txt -> ba

Re: basename equivalent?

2007-04-27 Thread Nishi
This is what i see c:\foo\bar\baz.txt -> c:\foo\bar\baz.txt /cygdrive/c/foo/bar/baz.txt -> baz.txt which is different from your output. On 4/27/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 4/27/07, Nishi <[EMAIL PROTECTED]> wrote: > The issue is when i use cygwin Perl

Re: basename equivalent?

2007-04-27 Thread Nishi
The issue is when i use cygwin Perl. On 4/27/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 4/27/07, Nishi <[EMAIL PROTECTED]> wrote: > I am having issues using File::Basename via cygwin perl. Is there a > workaround for that? Are you using cygwin's Perl or Activestate's Perl?

Re: basename equivalent?

2007-04-27 Thread Nishi
I am having issues using File::Basename via cygwin perl. Is there a workaround for that? On 4/26/07, Xavier Noria <[EMAIL PROTECTED]> wrote: On Apr 26, 2007, at 2:34 AM, Nishi wrote: > What is the equivalent of basename? Ie if I dont want to use basename > package to get the fi

Re: File::Basename issues

2007-04-27 Thread Nishi
Yes, its the cygwin perl to be blamed. Would setting the ACTIVESTATE environment variable help? before running the scripts that contain the basename usage? Thanks, Nishi. On 4/26/07, Ken Foskey <[EMAIL PROTECTED]> wrote: On Wed, 2007-04-25 at 17:15 -0700, Nishi wrote: > Hi: >

perl and cygwin perl (unix style paths)

2007-04-27 Thread Nishi
Hi gurus: I am trying to run perl command via cygwin. I have cygwin mapped drive in which i use the locally installed perl(and not cygwin perl) but apprently, that perl is not able to find an existing file. When the same command is run via cygwin perl, it runs fine. Does perl on windows understa

Re: basename equivalent?

2007-04-25 Thread Nishi
Rob: On 4/25/07, Rob Dixon <[EMAIL PROTECTED]> wrote: Nishi wrote: > > What is the equivalent of basename? Ie if I dont want to use basename > package to get the filename off a path, what reg expr can i use in perl? > > Would this work -- > my $fileName=$path =~ /.*

Re: basename equivalent?

2007-04-25 Thread Nishi
On 4/25/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Nishi wrote: > Hi: Hello, > What is the equivalent of basename? Ie if I dont want to use basename > package to get the filename off a path, what reg expr can i use in perl? > > Would this work --

basename equivalent?

2007-04-25 Thread Nishi
Hi: What is the equivalent of basename? Ie if I dont want to use basename package to get the filename off a path, what reg expr can i use in perl? Would this work -- my $fileName=$path =~ /.*\/(.+)$/; Thanks!

File::Basename issues

2007-04-25 Thread Nishi
5.8.0 perl\lib dir to 5.8.2 and 5.8.7 but it didnt work. I am just trying to strip of the filename $fn from a path such as C:\temp\myfile.txt $fn = basename($_); <-- should return myfile.txt Please let me know. Thanks, Nishi.

perl on strings

2007-04-19 Thread Nishi
Hi: I have a strings such as Formatting_l_cs.cat Formatting_l_da.cat Formatting_l_de.cat Formatting_l_zh-tw.cat I need to extract the substring before the "." and after the last occurence of "_" ie in the above cases, it would return "cs" or zh-tw" etc. How can I achieve this? Thanks!

reqular expr for string manip.

2007-04-18 Thread Nishi
Hi: I am using the following reqular expression to extract the last part ie $lang of the following string $topdir = "common/default/l_cs"; my $lang=$topdir =~ /.*\/(.+)$/; But it doesnt seem to work, what am i missing here? Thanks!

string manip

2007-04-18 Thread Nishi
Hi: I have a string of the form $ARGV[0]="abc/def/ghi"; I need to strip abc to convert $ARGV[0] to $ARGV[0]="def/ghi" Please let me know how I can achieve it. Thanks!

Re: how to create copy of a original file

2007-04-18 Thread Nishi
I got it. using File::Copy Thanks! On 4/18/07, Nishi <[EMAIL PROTECTED]> wrote: Hi: My perl program run creates a data file everytime its run is scheduled. I need to backup the data file everytime i run it so i have a copy of the original data file. How can i create a copy of this f

how to create copy of a original file

2007-04-18 Thread Nishi
Hi: My perl program run creates a data file everytime its run is scheduled. I need to backup the data file everytime i run it so i have a copy of the original data file. How can i create a copy of this file in my perl program before it gets updated. I am taking this file as user input from the co

perl errors: Unrecognized escape characters.............

2007-02-23 Thread Nishi Bhonsle
Hi: I see these errors when i run my perl script. Unrecognized escape \B passed through at C:\test.pl line 41. Unrecognized escape \o passed through at C:\test.pl line 41. Unrecognized escape \W passed through at C:\test.pl line 41. Unrecognized escape \W passed through at C:\test.pl line 41. Unr

Re: string manip.

2007-02-21 Thread Nishi Bhonsle
Hi: In case the string i am looking for is secondlast position as in instance/bit/bitGroup/default/tz/l_cs/messages How can i change the manip code to get l_cs in this case? Thanks! On 2/16/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Nishi Bhonsle wrote: > Hi: Hello, > I h

string manip.

2007-02-16 Thread Nishi Bhonsle
Hi: I have a string such as instance/bit/bitGroup/default/tz/l_cs where the last directory stands for os languages. I have to get the last directory and assign it to a var such as $mylang = l_cs, in the above example. How can i achieve that? Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: simple issue--Need Help

2006-07-25 Thread Nishi Bhonsle
uot;%HOME%/$src" "$src" I tried putting the chomp($src) after the 1st foreach loop and test and then put it after the second foreach loop and test. Neither works. On 7/25/06, bright true <[EMAIL PROTECTED]> wrote: > > remove the new line from $src , using > >

simple issue--Need Help

2006-07-25 Thread Nishi Bhonsle
Hi: The following code ends up adding new line after each column/field in the record $record in FILE2. #!/usr/bin/perl use strict; use warnings; use File::Basename; use File::Find; use IO::All; my $path = $ARGV[0]; my $io = io($path); my @new = $io->all_files; #get all files under $path forea

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Nishi Bhonsle
I got the last soln, ie to use File::Basename module. Please ignore the last thread. I am still interested to know why Rob's soln doesnt work for me? Thanks much! On 7/25/06, Nishi Bhonsle <[EMAIL PROTECTED]> wrote: Hi: In addition can i modify the all_files to return only t

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Nishi Bhonsle
Hi: In addition can i modify the all_files to return only the absolute filename and not the filename alongwith the entire path? Currently, it prints C:\..\..\..\File1.txt etc I really want it only print File1.txt Thanks! On 7/25/06, Nishi Bhonsle <[EMAIL PROTECTED]> wrote: Yes, all

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Nishi Bhonsle
Yes, all_files works. Its in the doc, and i missed it. Its my bad. Rob, I tried the code snippet you mentioned, apparently it doesnot return anything under the directory. Thanks, Nishi. On 7/25/06, Dr.Ruud <[EMAIL PROTECTED]> wrote: Rob Dixon schreef: >use strict; >

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Nishi Bhonsle
including the subdirectory listing. Thanks, Nishi. On 7/24/06, Dr.Ruud <[EMAIL PROTECTED]> wrote: "Nishi Bhonsle" schreef: > If I need to get the files without the "." and the ".." at the first > level only, then how can i modify the find command

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Nishi Bhonsle
i restrict the find command to only look for the files under the directory mentioned i.e. perl .pl C:\build\Sample\NewDir will only give File1.txt File2.txt and perl .pl C:\build\Sample\NewDir\NewSubDirectory will give 11.txt 12.txt Thanks again! -Nishi. On 7/22/06, Dr.Ruud <[EMAIL PROTECTED]&g

Re: get only filenames and not directory names under a specific path.

2006-07-21 Thread Nishi Bhonsle
That works like a charm, thanks! -Nishi. On 7/21/06, Wagner, David --- Senior Programmer Analyst --- WGO < [EMAIL PROTECTED]> wrote: Nishi Bhonsle wrote: > I tried it but didnt work. > my @new; > > find(sub {push @new, $_}, $path); find(sub {push(@new,$_) if ( !/^\

Re: get only filenames and not directory names under a specific path.

2006-07-21 Thread Nishi Bhonsle
file2.txt How can I not include the "." ? Thanks! -Nishi. On 7/21/06, Rob Dixon <[EMAIL PROTECTED]> wrote: Nishi Bhonsle wrote: > Hi: > I am starting a new thread based of an older thread just because there > was a > lot of different things that were requested for and i

get only filenames and not directory names under a specific path.

2006-07-20 Thread Nishi Bhonsle
Directory and hence this command does not work since it clubs files and directories and files within sub-directories. I tried using find(sub {push @new, $File::Find::name}, $path); but that prints the directories and files along with their complete/absolute paths, which is not what i need. Thanks in advance! -Nishi.

Re: write out filenames of files existing on a filesystem into afile

2006-07-19 Thread Nishi Bhonsle
-instance"; xsi:noNamespaceSchemaLocation="filemap.xsd"> On 7/12/06, Nishi Bhonsle <[EMAIL PROTECTED]> wrote: Hi: Sorry to start this thread again, but it would not have been wise to ask my related question in a different thread. I tried to run the prog

Re: write out filenames of files existing on a filesystem into afile

2006-07-16 Thread Nishi Bhonsle
Hi: If I am still using the below logic, how can i modify the below prog to ignore empty directories and list only directories containing directories and files in buildlist.txt ? opendir DIR, $path or die "Can't open $path: $!"; #my @new = grep /[^.]/, readdir DIR; my @new = grep { $_ ne "." a

manipulate strings to strip the beginning part

2006-07-16 Thread Nishi Bhonsle
Hi: I want to manipulate strings containing filenames that have the following format Web\SiA\web\..\..\ etc Web\SiAData\web\app\..\..\ etc to remove everything in the begining of web part of the above strings and store the rest of the part ie web\..\..\ into a new string. Thereafter I will refere

strip

2006-07-14 Thread Nishi Bhonsle
Hi: I have a filenames such as NQSname_l_cs.txt, NQSname_l_da.txt, NQSname_l_zh- tw.txt etc. I would like to modify these filenames such that they are NQSname.txt What regex i could use to modify these filenames? Thanks much.

How to get the OS local/default drive using perl?

2006-07-13 Thread Nishi Bhonsle
Hi: If I have to create a writeable file say write.txt on fly during program execution under the OS default/local drive of a machine ie C:\ or D:\ on windows and /home/user etc on unix, how can I get that local/default drive using perl so that I dont have to hardcode C:\ or D:\ or /home etc insid

How to ignore spaces in directory names?

2006-07-13 Thread Nishi Bhonsle
Hi: In writing a perl script to read the contents of a directory on a windows system, i noticed that there are some directory names have spaces in them. How can I modify the line below so it would ignore the spaces in the directory name and still process it ? opendir DIR, $path or die "Can't ope

Re: Check whether a string exists

2006-07-12 Thread Nishi Bhonsle
ntents to the console. How i can correct this? Thanks. On 7/12/06, Chasecreek Systemhouse <[EMAIL PROTECTED]> wrote: On 7/12/06, Nishi Bhonsle <[EMAIL PROTECTED]> wrote: > Hi: > > I would like to check whether the string [server_bin.files] exists in a > particular file an

Check whether a string exists

2006-07-12 Thread Nishi Bhonsle
Hi: I would like to check whether the string [server_bin.files] exists in a particular file and if it does, then do not add it again. How can I check for this string using perl regex? Thanks!

Re: write out filenames of files existing on a filesystem into afile

2006-07-12 Thread Nishi Bhonsle
Hi: Sorry to start this thread again, but it would not have been wise to ask my related question in a different thread. I tried to run the program on a windows machine, apparently the regex in question only lists directories within directories and not the files within the directories. I tried Rob'

Re: write out filenames of files existing on a filesystem into afile

2006-07-09 Thread Nishi Bhonsle
Yes, thank you. This is it. I was able to manage a similar working version, your post is much cleaner and easy to follow. Thanks again -Nishi. On 7/9/06, Rob Dixon <[EMAIL PROTECTED]> wrote: Nishi Bhonsle wrote: > > Thanks for all your suggestions and help. I was able to do t

Re: write out filenames of files existing on a filesystem into afile

2006-07-09 Thread Nishi Bhonsle
Hi: Thanks for all your suggestions and help. I was able to do the following -- 1)Flatten out the directory structure into a file containing the dir and files within the dir into C:\buildlist.txt 2)Read the lines from a file say files2.txt and modify the lines to contain the filenames fetched int

Re: write out filenames of files existing on a filesystem into a file

2006-07-07 Thread Nishi Bhonsle
ow how to read the line in the below file, look for the second and forth " and write the name of the file fetched in the above program before the second and fourth " and between the fifth and sixth " one by one. "SL/" "%HOME%/server/bin/" "" NA as in &q

write out filenames of files existing on a filesystem into a file

2006-07-07 Thread Nishi Bhonsle
Hi: Can you please help me write a perl script that takes the files from a directory and spits out the filenames into a file. say. I have a file structure on a file system such as C:\Temp\one C:\Temp\two C:\Temp\one\oneone C:\Temp\one\onetwo C:\Temp\one\onethree The original file contains lines

Perl script to search and replace a string in a file

2006-05-31 Thread Nishi Bhonsle
Hi: I have the following script that takes in an input file, output file and replaces the string in the input file with some other string and writes out the output file. I want to change the script to traverse through a directory of files ie instead of prompting for input and output files, the sc

set environment variables

2005-07-18 Thread Nishi Prafull
Hi: I need to run a script noted by $cmd1 from within perl but before that i need to set the environment variable. how can i do it? I tried my $TEMPHOME = "/tmp"; system($cmd1); But the script still complains the $TEMPHOME is not set. Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addi

Re: set environment variables

2005-07-18 Thread Nishi Prafull
I ttied it inside the perl script, but does not seem to work. I did a echo for $TEMPHOME but it was not set. On 7/18/05, John W. Krahn <[EMAIL PROTECTED]> wrote: > Nishi Prafull wrote: > > Hi: > > Hello, > > > I need to run a script noted by $cmd1 from within perl

platform independant log

2005-03-16 Thread Nishi Prafull
Hi : The following program needs to print the output of the cmd run to a log file, it takes care of the directory separator issue, so the log file could be created on any platform depending on where the program is run. But there is something missing ie the log file i am creating via this program do

Re: log output

2005-03-16 Thread Nishi Prafull
I just tried using the tctee program as follows: #!/usr/local/bin/perl5.6 -w use strict; my $logFile ='/automateLabelPush.log'; //line 5 my $tee_cmd = '/tctee.pl'; my $cmd1 = qq{ }; system("$cmd1 | $tee_cmd -a $logFile") ; at the end of the execution, I still get sh: syntax error at line 5: "|"

Re: log output

2005-03-16 Thread Nishi Prafull
IL PROTECTED]> wrote: > What if you piped your system command to tee, like: > > system("$cmd1 | tee -a outfile.log") ; > > > -Original Message- > From: Nishi Prafull [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 16, 2005 10:55 AM > To: beg

log output

2005-03-16 Thread Nishi Prafull
Hi: I am running a perl script as part of a cron job and I want to log the execution of the script(for sucess, failure). In my script, I make calls to external software on the machine to run certain tasks. How can I direct the output of these tasks to a local log on my machine during the execution

print to a log

2005-03-04 Thread Nishi Prafull
Hi: I am running an external command through my perl script and I wanted to print out the command output to some log file -- my $log = "/tmp/test.log"; my $cmd1 = qq{ ade useview viewname -exec 'ade label_product \\ -l $label -noinsert -prod dc' -print >> $log }; syst

Re: call a Perl script within another Perl script

2005-03-03 Thread Nishi Prafull
Analyst --- WGO <[EMAIL PROTECTED]> wrote: > Nishi Prafull wrote: > > Hi: > > Apparently I noticed that when I put both the commands I need to run > > in one script using the system call, the second command does not get > > executed ( I cannot figure out the cause). &

Re: call a perl script within another perl script

2005-03-03 Thread Nishi Prafull
have to do anything else in this regard? Thanks. On Thu, 3 Mar 2005 15:50:16 -0800, Tim Johnson <[EMAIL PROTECTED]> wrote: > > I guess it partly depends on what you are trying to accomplish. Why are > you calling a second script? > > > -Original Message- >

call a perl script within another perl script

2005-03-03 Thread Nishi Prafull
Hi: I would like to call a perl script(B.pl) within another perl script(A.pl). Should I use the following approach or something else? A.pl - my $cmd = "perl B.pl" system($cmd); Please let me know. Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

Re: RE : Perl program to convert system date to yymmdd

2005-03-03 Thread Nishi Prafull
yes :-) I realised that after sending you the email. Sorry! Thanks for the reply. On Thu, 3 Mar 2005 14:18:04 -0800, Wagner, David --- Senior Programmer Analyst --- WGO <[EMAIL PROTECTED]> wrote: > Nishi Prafull wrote: > > Hi All: > > > > Thanks for the replies.It wor

Re: RE : Perl program to convert system date to yymmdd

2005-03-03 Thread Nishi Prafull
gt; [mailto:[EMAIL PROTECTED] > >> Envoyé : jeudi 3 mars 2005 21:40 > >> À : Nishi Prafull > >> Cc : beginners@perl.org > >> Objet : RE: Perl program to convert system date to yymmdd > >> > >> Nishi Prafull wrote: > >>> On Thu, 3 M

Re: Perl program to convert system date to yymmdd

2005-03-03 Thread Nishi Prafull
On Thu, 3 Mar 2005 12:12:35 -0800, Wagner, David --- Senior Programmer Analyst --- WGO <[EMAIL PROTECTED]> wrote: > Nishi Prafull wrote: > > HI: > > > > I want to write a perl script that would compute the date in the > > format yymmdd(050303) and subsitute it for

perl program to convert system date to yymmdd

2005-03-03 Thread Nishi Prafull
HI: I want to write a perl script that would compute the date in the format yymmdd(050303) and subsitute it for a variable in the perl script. This variable is thereafter subsituted in a command that will be run inside the script. myTest.pl var aDate; get todays date and convert it to yymmdd and