06-19-2008
Quote:
Originally Posted by
zaxxon
I write it again:
There are plenty of examples on the internet how to use getopts. It helps parsing parameters/switches.
Thx..
Can you give example ?
10 More Discussions You Might Find Interesting
1. UNIX and Linux Applications
hi,
I have
* an IBM P550 machine,
* an AIX 5.3 running on it and
* an oracle database, already installed on it.
The problem (or question of my own) is:
Oracle tns listener, "CT_LISTENER", and the enterprise manager (EM) of the instance, which is uniq instance and called... (0 Replies)
Discussion started by: talipk
0 Replies
2. UNIX for Advanced & Expert Users
hi,
I have a problem about the Oracle related components. I'm not able to find any answer yet, and waiting for your responses...
Here is the configuration of my system:
* an IBM P550 machine,
* an AIX 5.3 running on it and
* an oracle database, already installed on it.
The problem (or... (1 Reply)
Discussion started by: talipk
1 Replies
3. Shell Programming and Scripting
input string="3MMTQSZ348GGMZRQWMJM4SD6M"
output string="3MMTQ-SZ348-GGMZR-QWMJM-4SD6M"
using linux shell script (4 Replies)
Discussion started by: pankajd
4 Replies
4. Shell Programming and Scripting
I am trying to write a if statement in KSH that if a string is start with abc then print something, I have written some code as below but it doesn't work.
Could someone please help me
if ]
then
print success
fi (5 Replies)
Discussion started by: yhever
5 Replies
5. Solaris
Hi all,
First off, sorry for a long post but I think I have no other option if I need to explain properly what I need help for.
I need some advise on how best to check for "faulty" or "stalled/jammed' print queues. At the moment, I have three (3) application servers which also acts as print... (0 Replies)
Discussion started by: newbie_01
0 Replies
6. Shell Programming and Scripting
logs:
"/home/abc/public_html/index.php"
"/home/abc/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
"/home/xyz/public_html/index.php"
how to use "cut" or "awk" or "sed" to get the following result:
abc
abc
xyz
xyz
xyz (8 Replies)
Discussion started by: timmywong
8 Replies
7. Shell Programming and Scripting
Hi Experts.
I'm stuck with the below AWK code where i'm trying to move the records containing any special characters in the last field to a bad file.
awk -F, '{if ($NF ~ /^|^/) print >"goodfile";else print >"badfile"}' filename
sample data
1,abc,def,1234,A *
2,bed,dec,342,* A ... (6 Replies)
Discussion started by: shell_boy23
6 Replies
8. Shell Programming and Scripting
Hello.
Following recommendations for one of my threads, this is working perfectly :
#!/bin/bash
CNT=$( grep -c -e "some text 1" -e "some text 2" -e "some text 3" "/tmp/log_file.txt" )
Now I need a grep success for some thing like :
#!/bin/bash
CNT=$( grep -c -e "some text_1... (4 Replies)
Discussion started by: jcdole
4 Replies
9. Shell Programming and Scripting
Dear Ladies & Gents,
I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out:
for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies
10. Programming
Hello !
I'm creating a CGI which allow to display graph from some data.
The datas looks like :
2020-01-13-00-00,384.00,350.00
2020-01-13-06-00,384.00,350.00
2020-01-13-12-00,384.00,350.00
2020-01-13-18-00,384.00,350.00
2020-01-14-00-00,384.00,350.00... (1 Reply)
Discussion started by: Tim2424
1 Replies
LEARN ABOUT REDHAT
getopt::std
Getopt::Std(3pm) Perl Programmers Reference Guide Getopt::Std(3pm)
NAME
getopt - Process single-character switches with switch clustering
getopts - Process single-character switches with switch clustering
SYNOPSIS
use Getopt::Std;
getopt('oDI'); # -o, -D & -I take arg. Sets $opt_* as a side effect.
getopt('oDI', \%opts); # -o, -D & -I take arg. Values in %opts
getopts('oif:'); # -o & -i are boolean flags, -f takes an argument
# Sets $opt_* as a side effect.
getopts('oif:', \%opts); # options as above. Values in %opts
DESCRIPTION
The getopt() function processes single-character switches with switch clustering. Pass one argument which is a string containing all
switches that take an argument. For each switch found, sets $opt_x (where x is the switch name) to the value of the argument if an argu-
ment is expected, or 1 otherwise. Switches which take an argument don't care whether there is a space between the switch and the argument.
The getopts() function is similar, but you should pass to it the list of all switches to be recognized. If unspecified switches are found
on the command-line, the user will be warned that an unknown option was given.
Note that, if your code is running under the recommended "use strict 'vars'" pragma, you will need to declare these package variables with
"our":
our($opt_x, $opt_y);
For those of you who don't like additional global variables being created, getopt() and getopts() will also accept a hash reference as an
optional second argument. Hash keys will be x (where x is the switch name) with key values the value of the argument or 1 if no argument
is specified.
To allow programs to process arguments that look like switches, but aren't, both functions will stop processing switches when they see the
argument "--". The "--" will be removed from @ARGV.
perl v5.8.0 2002-06-01 Getopt::Std(3pm)