Sponsored Content
Full Discussion: parsing argument in perl
Top Forums Shell Programming and Scripting parsing argument in perl Post 302551654 by hfreyer on Wednesday 31st of August 2011 08:12:32 AM
Old 08-31-2011
Code:
while (<>) {
  chomp; split;
  foreach $i (@_) {
    ...
  }
}

If you want to get more familiar with perl, in any case it is recommendable to study the man pages (which in case of perl are very instructive), the most basic ones are:
perlrun, perlsyn, perldata, perlop, perlfunc (second level: perlsub, perlre, perlvar)
This User Gave Thanks to hfreyer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script argument parsing

how to parse the command line argument to look for '@' sign and the following with '.'. In my shell script one of the argument passed is email address. I want to parse this email address to look for correct format. rmjoe123@hotmail.com has '@' sign and followed by a '.' to be more... (1 Reply)
Discussion started by: rmjoe
1 Replies

2. UNIX for Dummies Questions & Answers

command line argument parsing

how to parse the command line argument to look for '@' sign and the following with '.'. In my shell script one of the argument passed is email address. I want to parse this email address to look for correct format. rmjoe123@hotmail.com has '@' sign and followed by a '.' to be more... (1 Reply)
Discussion started by: rmjoe
1 Replies

3. Shell Programming and Scripting

argument parsing...

Hi all, Iam a beginer in shell scripting. i need a script that can parse the arguments and store them in variables. ex: ./myScript -v v1 -h v2 -c v3...... can someone suggest me...? tnx in adv. (1 Reply)
Discussion started by: midhun_u
1 Replies

4. Shell Programming and Scripting

not null cheking of an argument in perl

Hi, I have to check whether an argument say $ARGV is not null in an if operator. Please let me know the operator. It would be great if you write a psuedo code. Thanks in advance Ammu (4 Replies)
Discussion started by: ammu
4 Replies

5. Shell Programming and Scripting

problem with spaces and argument parsing

public class HelloWorld { public static void main(String args) { System.out.println("Welcome, master"); } } and I compiled using javac HelloWorld.java ] Suppose that I execute the following command directly from the shell: java -XX:OnError="gdb - %p" HelloWorld Then it works... (8 Replies)
Discussion started by: fabulous2
8 Replies

6. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies

7. Shell Programming and Scripting

Perl Parsing Argument

i wanna passing an argument which read in a file or a set of files if the files are given in the command line, otherwise use STDIN if no file argument. i got something like that, but it is not really working. so can anyone help me? which one is better to use for and how? Use perl. Thank you ... (0 Replies)
Discussion started by: mingming88
0 Replies

8. Shell Programming and Scripting

PERL need help splitting argument

If i have a script name.pl I run it like name.pl -v file.txt -t ext2 -u user -j how can I edit the array @ARGV so when my script calls $ARGV = -v file.txt $ARGV = -j (2 Replies)
Discussion started by: 3junior
2 Replies

9. Shell Programming and Scripting

How to use perl to run bash with argument?

Hi All, I want to run a bash script using perl. But they are in the different dir. #! /usr/bin/perl -w use strict; my $root=`pwd`; chomp($root); my $cmd=".$root/testdir/ft_623.sh 3 4 5 6 7"; print $cmd; my @line=`$cmd`; foreach (@line){ print $_; } ft_623.sh (0 Replies)
Discussion started by: Damon sine
0 Replies

10. Shell Programming and Scripting

Question about argument parsing in scripts

Hello all, I am relatively new to linux and bash scripting. I have what seems to be a simple question but I'm having trouble finding the answer. The question is what is the difference between the variables $@ and $*. I've seen them both used in the same context, and I've tried a number of... (4 Replies)
Discussion started by: nicthu
4 Replies
PERLINDEX(1p)						User Contributed Perl Documentation					     PERLINDEX(1p)

NAME
perlindex - index and query perl manual pages SYNOPSIS
perlindex -index perlindex tell me where the flowers are DESCRIPTION
""perlindex -index"" generates an AnyDBM_File index which can be searched with free text queries ""perlindex" a verbose query". Each word of the query is searched in the index and a score is generated for each document containing it. Scores for all words are added and the documents with the highest score are printed. All words are stemed with Porters algorithm (see Text::English) before indexing and searching happens. The score is computed as: $score{$document} += $tf{$word,$document}/$maxtf{$document} * log ($N/$n{$word}); where $N is the number of documents in the index, $n{$word} is the number of documents containing the word, $tf{$word,$document} is the number of occurances of word in the document, and $maxtf{$document} is the maximum freqency of any word in document. OPTIONS
All options may be abreviated. -maxhits maxhits Maximum numer of hits to display. Default is 15. -menu -nomenu Use the matches as menu for calling "man". Default is -menu.q -cbreak -nocbreak Switch to cbreak in menu mode or don't. -cbreak is the default. -verbose Generates additional information which query words have been not found in the database and which words of the query are stopwords. -conf Use another config than the default config (/etc/perlindex/config). EXAMPLE
perlindex foo bar 1 3.735 lib/pod/perlbot.pod 2 2.640 lib/pod/perlsec.pod 3 2.153 lib/pod/perldata.pod 4 1.920 lib/Symbol.pm 5 1.802 lib/pod/perlsub.pod 6 1.586 lib/Getopt/Long.pm 7 1.190 lib/File/Path.pm 8 1.042 lib/pod/perlop.pod 9 0.857 lib/pod/perlre.pod a 0.830 lib/Shell.pm b 0.691 lib/strict.pm c 0.691 lib/Carp.pm d 0.680 lib/pod/perlpod.pod e 0.680 lib/File/Find.pm f 0.626 lib/pod/perlsyn.pod Enter Number or 'q'> Hitting the keys 1 to "f" will display the corresponding manual page. Hitting "q" quits. All other keys display this manual page. FILES
The index will be generated in your man directory. Strictly speaking in "$Config{man1direxp}/.." The following files will be generated: index_fn # docid -> (max frequency, filename) index_idf # term -> number of documents containing term index_if # term -> (docid, frequency)* index_seen # fn -> indexed? AUTHOR
Ulrich Pfeifer <pfeifer@ls6.informatik.uni-dortmund.de> perl v5.14.2 2012-01-26 PERLINDEX(1p)
All times are GMT -4. The time now is 09:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy