perl command issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl command issue
# 1  
Old 09-12-2011
perl command issue

Hi,

Please could someone advise on a perl command :

Code:
export ENVPROP="$HOME/cfg/environment.properties.template"
 
export LM_LICENSE=`awk -F= '!/^#/ && /LM_LICENSE/{print $2}' environment.properties`
 
echo $LM_LICENSE
 
$DATA_FILE/licenses/sample.demo.lic
 
perl -i -npe "s#LM_LICENSE.*#LM_LICENSE=$LM_LICENSE#;" $ENVPROP

when I check the $ENVPROP

I only see the value :

Code:
LM_LICENSE=/licenses/sample.demo.lic

( the $DATA_FILE is missing ?? )

Have i entered the perl command wrong ?

thankyou

Last edited by radoulov; 09-12-2011 at 10:14 AM.. Reason: Code tags!
# 2  
Old 09-12-2011
Use Env module to fetch your environment variables in a Perl script, like so:

Code:
$
$ echo $LM_LICENSE
$DATA_FILE/licenses/sample.demo.lic
$
$
$ echo $ENVPROP
environment.properties.template
$
$
$ cat $ENVPROP
# this is a comment
The license file is LM_LICENSE with a value of blah.
$
$ perl -i -pne 'BEGIN {use Env qw (LM_LICENSE)} s/LM_LICENSE.*/LM_LICENSE=$LM_LICENSE/' $ENVPROP
$
$
$ cat $ENVPROP
# this is a comment
The license file is LM_LICENSE=$DATA_FILE/licenses/sample.demo.lic
$
$

tyler_durden
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl format issue

Input : day :15 and count -100 printf ("%6.6ld %10.10s %s\n",day,count) any idea what would be the format it will be. (3 Replies)
Discussion started by: ramkumar15
3 Replies

2. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

3. Shell Programming and Scripting

Perl script issue

Hi All, I have a perl script which I am using in Windows environment. There is one more file called "functions.txt" which is having all the functions defined to used in my perl script. And the path for this function file is defined in my perl script. Howeever sometimes I am getting below error... (4 Replies)
Discussion started by: gr8_usk
4 Replies

4. Shell Programming and Scripting

perl/unix: script in command line works but not in perl

so in unix this command works works and shows me a list of directories find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt but when i try running a perl script to run this command my $query = 'find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt';... (2 Replies)
Discussion started by: kpddong
2 Replies

5. Shell Programming and Scripting

wc -l command issue with perl

Hi Team, the Following program execute with out error but the out is not save with create2.txt. kindly help me!!! print "Enter your Number \n"; my $name = <STDIN>; if ($name =="*91111*") { @dirlist1 = `wc -l $name > create2.txt`; } else {print "do not match";} (3 Replies)
Discussion started by: adaleru
3 Replies

6. Shell Programming and Scripting

combine two perl lines into a single perl command

Hi Everyone, i have a string 00:44:40 so: $tmp=~ s/://gi; $tmp=~s/({2})({2})({2})/$1*3600+$2*60+$3/e; the output is 2680. Any way to combine this two lines into a single line? Thanks (4 Replies)
Discussion started by: jimmy_y
4 Replies

7. Shell Programming and Scripting

Perl issue - please help!

Hello. I've been writing some code in Perl to read in strings from html files and have been having issues. In the html file, each "paragraph" is a certain file on the website. I need to find every one of the files that is a certain type, in this case, having green color....therefore... (7 Replies)
Discussion started by: akreibich07
7 Replies

8. Shell Programming and Scripting

Perl Issue

Hi, I got this script from the web, this generates an LDAP report in CSV format. #!/usr/bin/perl # # Copyright (c) 2004 # Ali Onur Cinar &060;cinar&064;zdo.com&062; # # License: # # Permission to use, copy, modify, and distribute this software and its # documentation for... (23 Replies)
Discussion started by: raj001
23 Replies

9. Shell Programming and Scripting

[Perl] Accessing array elements within a sed command in Perl script

I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows: $count = 0; while ( $count < $#test ) { `sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`; `cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies

10. Shell Programming and Scripting

perl issue ..

hi one perl issue i have xml file with 2 values and one condition b.w them <rule> <val1>12</val1> <cond>and</cond> <val2>13</val2> </rule> i read these values in hash in perl code $one{val1} = 12 $one{cond} = and $one{val2} = 13 now i want to form... (3 Replies)
Discussion started by: zedex
3 Replies
Login or Register to Ask a Question