PERL & sh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting PERL & sh
# 1  
Old 05-03-2012
PERL & sh

hi,

I have command like this :

Code:
grep -w $server /dbu/oratab | awk -F : '{print $2}'

I want to put this line in PERL code. inside PERL , I am doing like this :

Code:
$ENV{ORAH}=`grep -w $server /dbu/oratab | awk -F : '{print $2}'`

how can I put this in PERL

Thanks
# 2  
Old 05-03-2012
Escape that $2 like \$2 so perl doesn't eat it.

If your perl script ends up being 90% shell code with a thin layer of perl though, it's probably better written in shell.
# 3  
Old 05-03-2012
Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PERL, Date & Time issues

Hello All, This is my first script in PERL. Hence require your help in moving further. I have a script which should populate the values for Today, Yesterday output. For which I use timeFrame as a variable to obtain the time in hrs:mm as 10:00. All I want is, I want my timeFrame to start... (4 Replies)
Discussion started by: sathyaonnuix
4 Replies

2. Shell Programming and Scripting

PERL foreach & open not working together

My script is as below: my $tile_list = `egrep "FCFP_TILE_LIST.*=" ${BudgetDir}/tile.params | sed -e 's/FCFP_TILE_LIST//' | sed -e 's/=//'`; print "Tile List = ".$tile_list."\n"; my @tiles = split(/\s+/, $tile_list); $unconst_out = "${DestDir}/Unconstrained_ports.rpt"; $check_tim_out =... (2 Replies)
Discussion started by: kuchi7
2 Replies

3. Shell Programming and Scripting

How would I do 2 search & replaces in 1 Perl statement?

Hi All, The below code successfully tails the logfile.log file and colors every word "ERROR" in RED, thanks to the Perl statement below. However, would anyone know how to append 1 additional search/replace to the Perl statement below, to color the word "SUCCESS" in GREEN (using ANSI \e ... (3 Replies)
Discussion started by: chatguy
3 Replies

4. Shell Programming and Scripting

Find & Replace string in multiple files & folders using perl

find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g' this is simple logic to find and replace in multiple files & folders Hope this helps. Thanks Zaheer (0 Replies)
Discussion started by: Zaheer.mic
0 Replies

5. Shell Programming and Scripting

Perl for Unix & Windows

Hi Even though this is unix forum, iam posting this thread as iam not sure of which forum should i post this too. I understand perl can be used in unix environment and i have used the same for automation of my processes. Eg: Open a file search the text string replace the text string close... (9 Replies)
Discussion started by: kenkanya
9 Replies

6. Shell Programming and Scripting

perl newbie . &&..programming newbie

Hi, I am new to programming and also to perl..But i know 'perl' can come to my rescue, But I am stuck at many places and need help..any small help is much appreciated... below is the description of what i intend to acheive with my script. I have a files named in this format... (13 Replies)
Discussion started by: xytiz
13 Replies

7. Shell Programming and Scripting

perl: Please explain this for me: $hexdigit = (0 .. 9, 'a' .. 'f')[$num & 15];

This is taken from perlop. I can't understand what's going on, please can someone explain this for me? $hexdigit = (0 .. 9, 'a' .. 'f'); to get a hexadecimal digit (2 Replies)
Discussion started by: ksheller
2 Replies

8. Shell Programming and Scripting

perl newbie . &&..programming newbie (question 2)

Hello everyone, I am having to do a lot of perl scripting these days and I am learning a lot. I have this problem I want to move files from a folder and all its sub folders to one parent folder, they are all .gz files.. there is folder1\folder2\*.gz and there are about 50 folders... (1 Reply)
Discussion started by: xytiz
1 Replies

9. UNIX for Advanced & Expert Users

Apache module & perl problem

I have a very strange problem that I can't seem to solve. I have apache module which filters content and within that module I will add some more content based on this calls: int check; check = system("/usr/bin/check"); check is a perl-script that exits with value 1 if the file doesn't... (2 Replies)
Discussion started by: hjalle
2 Replies

10. Shell Programming and Scripting

Perl & XML... Need help.

In the case that there are two cells under one row, I can only read the first cell. If anyone thinks they know how to deal with this please let me know. XML code: <Row> <Cell><Data ss:Type="String">Loved</Data></Cell> <Cell ss:Index="3"><Data ss:Type="Number">3.0</Data></Cell> ... (1 Reply)
Discussion started by: vincaStar
1 Replies
Login or Register to Ask a Question