Sponsored Content
Full Discussion: Perl map doubt
Top Forums Shell Programming and Scripting Perl map doubt Post 302374326 by rmv on Tuesday 24th of November 2009 06:10:14 AM
Old 11-24-2009
Perl map doubt

Hello ,

Please can someone tell me what exactly happens when the below filehandler is chomped into an array and later mapped.

$lcpLog="logcopy\@".getTimestamp."\log";

open CFg ,"< $lcpcfg";
chomp(@cfg = <CFG>);
close CFG;

@cfg=grep { $_ ne ' ' } map { lc + (split /\s*\/\//) [0] } @cfg;

Please explain what happens in above line
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl doubt plz explain....

hi all i wrote a shell script which uses perl script my code is : >cat filename | while read i >do >perl -e 'require "/home/scripts/abc.pl" ; abc("$i")' >done perl script used will simply check syntax of Cobol programs but it didn't work for me so i asked my colleague he suggested... (1 Reply)
Discussion started by: zedex
1 Replies

2. Shell Programming and Scripting

Perl script doubt?

Dear friends, I have two files. In first file first column ($1), i have numbers. The second file containes, the same number in the fourth column($4). I need a output file, matching the first file column 1 with second file column 4. The main thing is the output file lines will be sorted... (4 Replies)
Discussion started by: vasanth.vadalur
4 Replies

3. Shell Programming and Scripting

Doubt in Perl Variable declaration

Anyone please say what is the difference between $var and ${var} in perl Sometimes $var used and sometimes ${var} used in same program. Thanks in Advance, Prabhu ---------- Post updated at 09:34 AM ---------- Previous update was at 05:59 AM ---------- Any one please clarify (1 Reply)
Discussion started by: prsampath
1 Replies

4. Shell Programming and Scripting

Grep and map in perl

Hi guys, I'm trying to learn grep and map and having a little problem. Let's say I have a file which contains: Apple: abcdcabdadddbac I want to replace any combinations of three of abcd, thus when I do this: print grep {s/{3}/X/g} <F>; # will do the subtitution fine, output XXXX ... (1 Reply)
Discussion started by: new bie
1 Replies

5. Shell Programming and Scripting

How to map the values of an array in perl?

Hi, I have 2 arrays: @names=qw(amith veena chaitra); @files=qw(file.txt file1.txt file3.txt); There is one to one relationship between names and files. There needs to be mapping created between names and files. The output should be like this: amith --> file.txt veena --->... (3 Replies)
Discussion started by: vanitham
3 Replies

6. Shell Programming and Scripting

Trivial perl doubt about FILE

Hi, In the following perl code: #!/usr/bin/perl -w if (open(FILE, "< in_file")) { while (<FILE>) { chomp($_); if ($_ =~ /patt$/) { my $f = (split(" ", $_)); print "$f\n"; } } close FILE; } Why changing the "FILE" as... (4 Replies)
Discussion started by: royalibrahim
4 Replies

7. Shell Programming and Scripting

perl doubt

Hi, Please help me to understand the following code: perl -lne 'print if "$_ " =~ /(5 (?:\d+ ){5})\1/' What the regular expression "?:" does? Also, whether the expression "\1" is the same as in sed (i.e) printing the elements inside pair of parentheses? (3 Replies)
Discussion started by: royalibrahim
3 Replies

8. Shell Programming and Scripting

Looping in Perl based on defined keys in Map

Hello All, I am writing the below script where it will connect to database and returns the results. #!/sw/gcm/perl510/bin/perl use SybaseC; &openConnection; &loadvalues; sub openConnection { $dbproc = new SybaseC(SYDB}, $ENV{DBDFLTUSR}, $ENV{DBDFLTPWD}); if... (2 Replies)
Discussion started by: filter
2 Replies

9. Shell Programming and Scripting

Perl combine multiple map statements

I have a file like file. file.TODAY.THISYEAR file.TODAY.LASTYEARI want to substitute the words in caps with their actual values so that output should look like file.140805 file.140805.2014 file.140805.2013For this I am reading the file line bye line in an array and using multiple map... (1 Reply)
Discussion started by: sam05121988
1 Replies

10. Shell Programming and Scripting

Understanding an example of perl map() function

Hello, I have many folders under which there is always a file with the same name, which contains the data I need to process later. A perl oneliner was borrowed perl -e 'print "gene_id\t", join("\t", map {/(.*)\//; $1} @ARGV),"\n";' *_test.trim/level.csvto make a header so that each column... (5 Replies)
Discussion started by: yifangt
5 Replies
BBCOMBOTEST.CFG(5)						File Formats Manual						BBCOMBOTEST.CFG(5)

NAME
bbcombotest.cfg - Configuration of bbcombotest tool SYNOPSIS
$BBHOME/etc/bbcombotest.cfg DESCRIPTION
bbcombotest(1) uses it's own configuration file, $BBHOME/etc/bbcombotest.cfg Each line in this file defines a combined test. FILE FORMAT
Each line of the file defines a new combined test. Blank lines and lines starting with a hash mark (#) are treated as comments and ignored. The configuration file uses the hostnames and testnames that are already used in your Xymon bb-hosts file. These are then combined using normal logical operators - "||" for "or", "&&" for "and" etc. A simple test - e.g. "Web1.http" - results in the value "1" if the "http" test for server "Web1" is green, yellow or clear. It yields the value "0" if it is red, purple or blue. Apart from the logical operations, you can also do integer arithmetic and comparisons. E.g. the following is valid: WebCluster.http = (Web1.http + Web2.http + Web3.http) >= 2 This test is green if two or more of the http tests for Web1, Web2 and Web3 are green. The full range of operators are: + Add - Subtract * Multiply / Divide % Modulo | Bit-wise "or" & Bit-wise "and" || Logical "or" && Logical "and" > Greater than < Less than >= Greater than or equal <= Less than or equal == Equal There is currently no support for a "not" operator. If you need it, use the transcription "(host.test == 0)" instead of "!host.test". NB: All operators have EQUAL PRECEDENCE. If you need something evaluated in a specific order, use parentheses to group the expressions together. If the expression comes out as "0", the combined test goes red. If it comes out as non-zero, the combined test is green. Note: If the expression involves hostnames with a character that is also an operator - e.g. if you have a host "t1-router-newyork.foo.com" with a dash in the hostname - then the operator-character must be escaped with a backslash '' in the expression, or it will be interpreted as an operator. E.g. like this: nyc.conn = (t1-router-nyc.conn || backup-router-nyc.conn) EXAMPLE
WebCluster.http = (Web1.http || Web2.http) AppSrvCluster.procs = (AppSrv1.conn && AppSrv1.procs) || (AppSrv2.conn && AppSrv2.procs) Customer.cluster = WebCluster.http && AppSrvCluster.procs The first line defines a new test, with hostname "WebCluster" and the columnname "http". It will be green if the http test on either the "Web1" or the "Web2" server is green. The second line defines a "procs" test for the "AppSrvCluster" host. Each of the AppSrv1 and AppSrv2 hosts is checked for "conn" (ping) and their "procs" test. On each host, both of these must be green, but the combined test is green if that condition is fulfilled on just one of the hosts. The third line uses the two first tests to build a "double combined" test, defining a test that shows the overall health of the system. FILES
$BBHOME/etc/bbcombotest.cfg SEE ALSO
bbcombotest(1) Xymon Version 4.2.3: 4 Feb 2009 BBCOMBOTEST.CFG(5)
All times are GMT -4. The time now is 07:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy