File output - help

2008-06-24 Thread jet speed
Hi, I am beginner to perl, I have a file name cxout and i want to capture just the LUN 415, LUN 815 into arrray & then print from the array. my idea is to capture different element form this file and the print form the array. Any help would be much appericated. my sample script looks as below.

Re: File output - help

2008-06-24 Thread jet speed
Thanks Dermot, it gives me the required output. Much appreciated. On 6/24/08, Dermot <[EMAIL PROTECTED]> wrote: > > Welcome, > > > 2008/6/24 jet speed <[EMAIL PROTECTED]>: > > Hi, > > > > I am beginner to perl, > > > > I have a file n

Re: File output - help

2008-06-25 Thread jet speed
Thanks Rob, Much appreciated Sj On 6/24/08, Rob Dixon <[EMAIL PROTECTED]> wrote: > > Dermot wrote: > > Welcome, > > > > > > 2008/6/24 jet speed <[EMAIL PROTECTED]>: > >> Hi, > >> > >> I am beginner to perl, > >>

Optimize the script

2008-07-04 Thread jet speed
Hi All, I put togather a piece of code with some help, to capture the output as below from a file "cxout1" as below. I am sure this can be written in few lines or even differnt way of getting the same out put with use of hash etc. Kindly help me to optimize the code. Any help would be much apperic

Re: Optimize the script

2008-07-04 Thread jet speed
Hi Rob, Great, Thanks it works. Perfect. I Will explore your recommendation for using seek File option. I will read some doc. In your code, Pls explain what this piece of code does. $sl{$1}++ if /\bID=(CK\w+)/i; Many Thanks Js On 7/4/08, Rob Dixon <[EMAIL PROTECTED]> wrote: > &g

Re: Optimize the script

2008-07-04 Thread jet speed
Hi Rob, I think it finds the bit starting with CK, if matches it stores in $sl($1) and finally prints the key value as. keys %sl, bec's all matches are same it strores only once. am i correct ? Pls correct me if am wrong. Many Thanks Js On 7/4/08, jet speed <[EMAIL PROTECTED]> wr

Re: Optimize the script

2008-07-04 Thread jet speed
Hi Rob, Great, Thanks for sorting this out, Much appericiated. Cheers Js On 7/4/08, Rob Dixon <[EMAIL PROTECTED]> wrote: > > jet speed wrote: > > > > Great, Thanks it works. Perfect. > > > > I Will explore your recommendation for using seek File option. I

Re: Optimize the script

2008-07-04 Thread jet speed
On 7/4/08, John W. Krahn <[EMAIL PROTECTED]> wrote: > > jet speed wrote: > >> Hi All, >> > > Hello, > > I put togather a piece of code with some help, to capture the output as >> below from a file "cxout1" as below. I am sure this can be writ

rename files in directory - help

2008-07-14 Thread jet speed
Hi All, I put togather few lines of code, I am looking to achieve the below dir1 with file1, file2 dir2 with file1, file2 i want to copy the files from each of the directory to a third directory dir3 as file1, file2 from dir1 and rename the file1 as file3 and file2 as file4 from the dir2. dir

Re: rename files in directory - help

2008-07-15 Thread jet speed
On 7/14/08, Rob Dixon <[EMAIL PROTECTED]> wrote: > > > jet speed wrote: > > > > I put togather few lines of code, I am looking to achieve the below > > > > dir1 with file1, file2 > > dir2 with file1, file2 > > > > i want to copy the files

Help on regular expression !!

2009-08-03 Thread jet speed
Guys, I am new to perl, I am having trouble capturing the required output from the command, with my limited knowlege i tried to put something togather. not sure how to proceed beyond. What i am trying to achieve for certain drives ex : B3494_901, B3494_102 from the outputlist is to find the ind

Re: Help on regular expression !!

2009-08-03 Thread jet speed
On Mon, Aug 3, 2009 at 4:00 PM, John W. Krahn wrote: > jet speed wrote: > >> Guys, >> > > Hello, > > I am new to perl, I am having trouble capturing the required output from >> the command, with my limited knowlege i tried to put something togather.

Re: Help on regular expression !!

2009-08-03 Thread jet speed
On Mon, Aug 3, 2009 at 5:45 PM, John W. Krahn wrote: > jet speed wrote: > >> >> Hi John, Thanks for your help, Much appreciated. Please could you also >> refer any good reference for Regular expression for a beginer like me, >> would >> be great. >>

Convert Array's into hashes

2009-08-06 Thread jet speed
Hi, I have a query on converting arrays into hash.Please could you help me resolve the below. I have 2 arrays as bleow. @array1 = ( D_101 D_102 D_103 D_104); @array2 = (0 1 2 3); How can i convert both of these arrays into %hash, assigining the @array1 as keys and @array2 as values. How can I

Re: Convert Array's into hashes

2009-08-06 Thread jet speed
On Thu, Aug 6, 2009 at 11:49 AM, Telemachus wrote: > On Thu Aug 06 2009 @ 11:19, jet speed wrote: > > @array1 = ( D_101 D_102 D_103 D_104); > > @array2 = (0 1 2 3); > > > > > > How can i convert both of these arrays into %hash, assigining the > >

'Join' query

2009-08-07 Thread jet speed
Hi, I would like to join the $abc with ':' the final desired output 1:2:3:4:5 #!/usr/bin/perl use strict; use warnings; my $abc = "1 2 3 4 5"; my $out = join ':', $abc; print "$out"; executing the above, i get the same output 1 2 3 4 5, not sure were am going wrong. Any help on this would be

Re: 'Join' query

2009-08-07 Thread jet speed
On Fri, Aug 7, 2009 at 4:46 PM, Shawn H. Corey wrote: > jet speed wrote: > >> Hi, >> >> I would like to join the $abc with ':' the final desired output 1:2:3:4:5 >> >> #!/usr/bin/perl >> >> use strict; >> use warnings; >>

$_ substitution Question

2010-03-26 Thread jet speed
Hi, I have a simple code below, ### #!/usr/bin/perl use strict; use warnings; my @list =( '/usr/data/logs' , '/usr/data1/logs'); foreach (@list) { print "$_ \n"; system "(/usr/bin/find "$_" -mtime 3 -print -exec ls '{}' \;)"; } ###

Re: $_ substitution Question

2010-03-29 Thread jet speed
Many Thanks Simon, John and everyone else for pointing me to the correct direction. Cheeers !! Js On Fri, Mar 26, 2010 at 7:03 PM, Shlomi Fish wrote: > On Friday 26 Mar 2010 20:51:17 John W. Krahn wrote: > > jet speed wrote: > > > Hi, > > > > Hello, > &

Re: $_ substitution Question

2010-04-01 Thread jet speed
up/logs/bprd : No such file or directory # Kindly let me know why this error. Regds Js On Mon, Mar 29, 2010 at 4:35 PM, jet speed wrote: > Many Thanks Simon, John and everyone else for pointing me to the correct > direction. Cheeers !! > Js > > On Fri, Mar 26, 2010 at 7:

Re: $_ substitution Question

2010-04-01 Thread jet speed
r/bin/find "$_" -mtime 3 -exec ls -l '{}' \\\;)] } } error output /usr/bin/find: stat() error /usr/openv/netbackup/logs/bpcd : No such file or directory /usr/bin/find: stat() error /usr/openv/netbackup/logs/bprd : No such fil

Re: $_ substitution Question

2010-04-02 Thread jet speed
On Thu, Apr 1, 2010 at 5:58 PM, Shawn H Corey wrote: > jet speed wrote: > >> Hi Chaps, >> >> I need bit more help with this, i slightly modified the code based on the >> inputs, still having the same issue of $_ substitution. >&g

Capture nth element of a file

2011-01-21 Thread jet speed
Hi All, I need some help with the blow. I have a an input file with the below data 1835 1836 1837 1838 1839 183A 183B 183C 183D #!/usr/bin/perl use strict; use warnings; my $filename; $filename = "input.txt" ; open (FILE, "< $filename" ) or die "Could not open $filename: $!"; while () { chomp

Re: Capture nth element of a file

2011-01-21 Thread jet speed
On Fri, Jan 21, 2011 at 5:35 PM, jet speed wrote: > > > On Fri, Jan 21, 2011 at 5:18 PM, Jim Gibson wrote: > >> On 1/21/11 Fri Jan 21, 2011 8:43 AM, "jet speed" >> scribbled: >> >> > Hi All, >> > I need some help with the

help to capture the elements, every 8th, followed by 7 elements

2011-01-28 Thread jet speed
Hi All, I need help on this one please. I have a input file with the following data. The 7 times 000s i have added in the input file in order to start with 1808 as the eight element. which works ok. am sure there is a better way. now once i captre the 8th element ex: 1808, then 1810 so on in the

Re: help to capture the elements, every 8th, followed by 7 elements

2011-01-28 Thread jet speed
On Fri, Jan 28, 2011 at 3:49 PM, Rob Dixon wrote: > On 28/01/2011 15:26, jet speed wrote: > >> Hi All, >> >> I need help on this one please. >> >> I have a input file with the following data. The 7 times 000s i have added >> in the input file in ord

format output from system command

2011-04-14 Thread jet speed
Hi, I need help in formatting ouput from system command, i could'nt figure out a way to format output from system command. appreciate your help with this, the details are below. hlis3 is file with list of clients hosta hostb hostc hostd The below program looks through each client and outputs t

format output from system command

2011-04-14 Thread jet speed
Hi, I need help in formatting ouput from system command, i could'nt figure out a way to format output from system command. appreciate your help with this, the details are below. hlis3 is file with list of clients hosta hostb hostc hostd The below program looks through each client and outputs t

Regular expression help !!

2011-04-27 Thread jet speed
Hi, Please could you advice, how can i write a regular expression for the line below to capture 0079 and 69729260057253303030373 0079 Not Visible 69729260057253303030373 i tried this one, no luck /(^\d{4})\s\w+\s\w+\s+\d+/ig) Appreciate your help with this. Sj -

Re: Regular expression help !!

2011-04-27 Thread jet speed
(\d{4})\s[a-z]{1,3}\s[a-z]{1,7}\s*(\d{1,32})\b/i) { push (@dev, $1); push (@wwn, $2); } } print "@dev \n"; print "@wwn \n"; ./wwnmod.pl 0079 69729260057253303030373 Regards Sj On 4/27/11, Rob Dixon wrote: > On 27/04/2011 11:47, jet speed wrote: >>

Re: Regular expression help !!

2011-04-27 Thread jet speed
Excellent Guys, I would like thank each one of you for inputs. Much appreciated. i got blinded by just the numbers 0079, i didn't cater for the next line which is hex 007A, as one of you rightly pointed out [ 0-9A-Z] , does the trick. its amazing to see different technique to achieve the same res

Regular Expression help!

2011-05-11 Thread jet speed
Hi All, I need help in matching the regular expression, the file is as below. I am trying to match number followed by Number ex 587, 128 in $1 and 60:06:01:60:42:40:21:00:3A:AA:55:37:91:8A:DF:11 in $2 the $1 match works find with regulare expression #if ($_=~ /\w{7}\s\w{4}\s\w{6}\s(\d{1,4})/i)

Re: Regular Expression help!

2011-05-11 Thread jet speed
Hi All, Thanks for your time and valuable inputs, Appreciate it. I will try your suggestions and test it in my program. Sj

join each entries in a file

2012-08-14 Thread jet speed
Hi All, I have a file as below file.txt 5008449AFB7494 5008449AFB749C 5008449AFB779D now i want to introduce : inbetween as below for each of these entries in the file 50:00:00:08:44:9A:FB:74:90 i did come across join function in perl, not sure how to apply inbetween each entries

Re: join each entries in a file

2012-08-14 Thread jet speed
5:cd:16:ca 50:00:00:08:44:9a:fb:74:90 Thanks Sj On Tue, Aug 14, 2012 at 11:04 AM, Shlomi Fish wrote: > Hi Sj, > > On Tue, 14 Aug 2012 10:55:13 +0100 > jet speed wrote: > > > Hi All, > > > > I have a file as below > > > >

Re: join each entries in a file

2012-08-14 Thread jet speed
Thanks Shawn, Appreciate your help !! On Tue, Aug 14, 2012 at 12:57 PM, Shawn H Corey wrote: > On Tue, 14 Aug 2012 11:50:14 +0100 > jet speed wrote: > > > i have an @newfa with 50:00:00:08:44:9a:fb:79:90 > > 50:00:00:90:44:9a:fb:30:90 50:00:00:55:44:9a:fb:79:66 and a fil

array match- help !

2012-08-17 Thread jet speed
Hi All, I have the below program. i can match the entries in actzone.txt file in bluealias.txt and print it. what i would like to achive is to print the alias name and the reated wwn for each zone that matched in 2 formats in different file ex. as below. Please could you help me achieve this. o

Re: array match- help !

2012-08-17 Thread jet speed
:AARA_30767_CL45 50:00:00:08:44:9a:fb:64:90 On Fri, Aug 17, 2012 at 1:21 PM, Shlomi Fish wrote: > Hi jet speed, > > On Fri, 17 Aug 2012 12:10:47 +0100 > jet speed wrote: > > > Hi All, > > > > I have the below program. i can match the e

Re: array match- help !

2012-08-17 Thread jet speed
AARA_30767_CL45 50:00:00:08:44:9a:fb:64:90 --- file: actzone.txt zone:tstdetdr_B_AARA_30767_CL45 zone:artdetdr_B_AARA_30767_CL45 --- Thanks Sj On Fri, Aug 17, 2012 at 3:52 PM, Shawn H Corey wrote: > On Fri, 17 Aug 2012 15:10:03 +0100

matching array elements from hash ?

2012-08-19 Thread jet speed
Hi All, Is there a way to find matching array elements from hash. ex: @names = ( abc. def. ghi, jky; ); %stud = ( " abc" =>" 34", "nba" =>"99", "def" =>"24", "ghi"=> "33"); How can i go throught each elements of has %stud and print the matching array value in this case abc =34 def=24 Thank

Re: matching array elements from hash ?

2012-08-20 Thread jet speed
On Sun, Aug 19, 2012 at 10:48 PM, timothy adigun <2teezp...@gmail.com>wrote: > Hi, > > Please, Check my comments below. > > On 8/19/12, jet speed wrote: > > Hi All, > > > > Is there a way to find matching array elements from hash. > > > > ex:

Re: matching array elements from hash ?

2012-08-20 Thread jet speed
Thanks John, worked as a treat. Appreciate it. On Sun, Aug 19, 2012 at 11:18 PM, John W. Krahn wrote: > jet speed wrote: > >> Hi All, >> > > Hello, > > > Is there a way to find matching array elements from hash. >> >> ex: >> >> @n

How to format the data ??

2012-08-22 Thread jet speed
Hi All, Please advice me on now to capture the data below in the format as below. i thought of using hash, but then the problem is each DisplayDevNum has multiple WWN. some has 4 elements, some has 2. Any other method ? Apprecaite your comments. i want to caputre in the below format. DisplayDe

Re: How to format the data ??

2012-08-22 Thread jet speed
Hi Rob, Thanks for the detailed explanation. Appreciate it. Yes, perfect. All the details are captured. i should be able to modify the output from your code. Thanks Sj On Wed, Aug 22, 2012 at 5:01 PM, Rob Coops wrote: > > > On Wed, Aug 22, 2012 at 4:39 PM, jet speed wrote: &g

Re: How to format the data ??

2012-08-23 Thread jet speed
Excellent !!. Thanks Tim. Appreciate your help. On Thu, Aug 23, 2012 at 12:22 AM, timothy adigun <2teezp...@gmail.com>wrote: > Hi jet speed, > I think is a lot better using hash or hash reference as implemented > in perldsc to do this. > Like so: > > #!/usr/bin/pe

print 2 array elements

2012-09-05 Thread jet speed
Hi All, I would like to print array1 with array2 as below ex: output --- abc-12 20/1 def-22 30/22 ghi-33 40/3 def-22 20/1 @array1 ="abc-12, def-22, ghi-33,abc-12,def-22"; @array2 ="20/1, 30/22, 40/3, 20/1"; i did try to map array1 to array2 elements, did'nt work. %hash = map {$array1[

Re: print 2 array elements

2012-09-05 Thread jet speed
Thanks Sholmi. Appreciate your help !. that's correct, i did make up the syntax, bec's the actual program is in a different system, were i cannot access mail. Cheers Sj On Wed, Sep 5, 2012 at 12:10 PM, Shlomi Fish wrote: > Hi jet speed, > > On Wed, 5 Sep 2012 11:47:4

regx substitution question

2012-09-05 Thread jet speed
Hi All, i have an regx question. i have the array contents, now i want to remove the first 2 characters (fc) of each element in the array and store it in a second array ex: @array2 @array ="fc20/1, fc30/22, fc40/3, fc20/1"; output @array2 ="20/1, 30/22, 40/3, 20/1"; please advice. Thanks Sj

Array elements in Hash

2012-10-04 Thread jet speed
Hi All, I am trying to find the array elements in hash, if it matches then print the hash value. Please help me to achieve this. Note: array elements matches the first 2 characters of the hash keys. @match = ("6c7b00", "6d7b00", "6d9d8f", "6c6863", "6e6632"); %abc = ('6c' => device1, '6d'=>d

Re: Array elements in Hash

2012-10-05 Thread jet speed
@match = ("6c7b00", "6d7b00", "6d9d8f", "6c6863", "6e6632"); > > > %abc = ('6c' =>'device1', '6d'=> 'device5', '6e'=> 'device3', > '6g'=>'device9'); > > f

Re: Array elements in Hash

2012-10-05 Thread jet speed
Great. Thanks Shekar ! On Fri, Oct 5, 2012 at 12:37 PM, Shekar wrote: > Yes. Loop through the array, for each element get the first 2 characters > using substr, then pass it to hash as key to get the corresponding value. > > -- > Shekar > > > > > On Fri, Oct

Perl module for CSV output

2012-10-24 Thread jet speed
Hi All, i have a requirement to output of hash from a perl script into a CSV format. Please could you advice what is the best perl module to achieve this. Thanks Sj

data extract - Help !

2012-11-13 Thread jet speed
Hi All, I have a file with similar data, around 10,000 entries with similar format. i need to extract the output in below format. I can match the WWN and push into an arrray, however i am not sure how to reference the WWN to its corresponding device displayDevNum as in the below format. Any hel

Re: data extract - Help !

2012-11-13 Thread jet speed
Hi Shlomi, Appreciate your help, your loop works perfectly !. On Tue, Nov 13, 2012 at 12:12 PM, Shlomi Fish wrote: > Hi Jet Speed, > > On Tue, 13 Nov 2012 11:44:26 +0000 > jet speed wrote: > > > Hi All, > > > > I have a file with similar data, around 10,

hash help !

2012-11-14 Thread jet speed
Hi Is there a way, i can build an %hash from a file as Input. Appreciate you help with this. file.txt 22:5a => 10.00.00.00.aa.56.9b.7a 32:9c => 10.00.00.00.aa.46.9b.33 a2:cc=> 10.00.00.00.aa.5a.9b.63 Thanks Sj

Re: hash help !

2012-11-15 Thread jet speed
On Thu, Nov 15, 2012 at 8:46 AM, Dr.Ruud wrote: > On 2012-11-15 03:07, Uri Guttman wrote: > > my %hash = read_file( 'file.txt' ) =~ /^(.+)\s*=>\s*(.+)$/mg ; >> > > Trailing whitespace in the keys? Skipping empty values? > > my %kv= read_file( 'file.txt' ) =~ /^(.+?)\s*=>\s*(.*)/mg; > > an

Re: hash help !

2012-11-15 Thread jet speed
On Thu, Nov 15, 2012 at 11:43 AM, Charles DeRykus wrote: > On Thu, Nov 15, 2012 at 2:46 AM, jet speed > > ... > > I was able to build the hash, however the file contains approx 10,000 > > entries. but while i print the hash i get only approx 1300 lines or > > key=&g

Re: hash help !

2012-11-15 Thread jet speed
On Thu, Nov 15, 2012 at 2:49 PM, jet speed wrote: > > > On Thu, Nov 15, 2012 at 11:43 AM, Charles DeRykus wrote: > >> On Thu, Nov 15, 2012 at 2:46 AM, jet speed >> > ... >> > I was able to build the hash, however the file contains approx 10,000 >> &

Re: hash help !

2012-11-16 Thread jet speed
On Thu, Nov 15, 2012 at 10:06 PM, Chris Charley wrote: > > > "jet speed" wrote in message news:CAG1VzcezebNiFar3YKep- > > What i am trying to do ? >> I want to match the entries from file1.txt with file.txt, if matches then >> print the key and value. some

Regular expression help pls !

2013-08-23 Thread jet speed
Chaps, Please i need help on the regular expression, i have the sample code below. I only want to match the entries from the array to the file and print the matching line for example if i only want to match fc3/23, in my code it prints both the lines fc3/2 and fc3/23. How to restrict to exact mat

Re: Regular expression help pls !

2013-08-23 Thread jet speed
Chaps, I am testing all your code one by one, Appreciate your time and detailed inputs. Many Thanks Sj On Fri, Aug 23, 2013 at 6:01 PM, Jim Gibson wrote: > > On Aug 23, 2013, at 9:06 AM, jet speed wrote: > > > Chaps, > > > > Please i need help on the regular ex

Match Hash Key's with Array elements

2013-12-13 Thread jet speed
Dear All, I have sample code below, i am trying print the matching array element values sorted in the hash. As you would notice only one of the array element "x1259" will print its value "IDT" stored in the hash. Please could you advice how can i get rest of the array elements matched in the has

Re: Match Hash Key's with Array elements

2013-12-13 Thread jet speed
Thanks - Shaji, Uri and Shawn for your valuable inputs. Apprecaite it. Cheers ! On Fri, Dec 13, 2013 at 3:33 PM, Uri Guttman wrote: > On 12/13/2013 10:21 AM, Shaji Kalidasan wrote: > >> Greetings, >> >> Thanks a bunch Uri and Shawn for providing valuable inputs. >> >> Here is the optimized c

file edit

2014-02-26 Thread jet speed
Chaps, Any quick one liner code in perl were i can get rid off the before and after wwn each line for file as below file --- device name lz_09_red_e10 vsan 200 * fcid 0xef0013 [pwwn 50:00:00:00:99:00:66:7a] * fcid 0xegg015 [pwwn 10:00:00:55:99:a8:d9:c4] [ pe-tgh10-hostb] device name lz_09_

Re: file edit

2014-02-26 Thread jet speed
Thanks Jim and Paul, Appreciate your inputs. Sj. On Wed, Feb 26, 2014 at 4:47 PM, Paul Johnson wrote: > On Wed, Feb 26, 2014 at 03:59:40PM +0000, jet speed wrote: > > Chaps, > > > > Any quick one liner code in perl were i can get rid off the before and > > afte