Sponsored Content
Top Forums Shell Programming and Scripting Two arguments for optional switch Post 302517900 by baraghun on Thursday 28th of April 2011 05:25:15 AM
Old 04-28-2011
I have posted some wrong phrase in my previous post..

It should be something in this way .

Code:

${basename} [ -c <LOG_FILE> | -o <DATE:YYYY-MM-DD> <LOG_FILE> ]

The only difference between Current Log & Archive Log is that its suffix.

Current Log Format : LOG_FILE_Group1, LOG_FILE_Group2, LOG_FILE_Group3
Archive Log Format : LOG_FILE_Group[1-3]_2011-02-12.log.gz

If script running with option -o
Firstly It will check with DATE
Secondly It will Check with LOG_FILE

Code:
ls -ltr | grep -i 2011-02-12 | grep -i LOG_FILE_Group*

If $?=0

It does the gzgrep -i STRING LOG_FILE_Group* > OutputFile

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to make parameters optional?

Hi, I am trying to call a function inside a shell script. Is there a way in which I can make the parameters options in the call? Please help me with this. Thanks!!! (2 Replies)
Discussion started by: neeto
2 Replies

2. Shell Programming and Scripting

grep with regular expression optional value

field 12345 12345 field 12345 field 12345 123456 last fleld (from three) is optional, but if it occures It has to be composed only of nummbers and maximum 5 positions long. If I use: grep "^field \{5\}" I get: field 12345 12345 field 12345 field 12345 123456 But I wont... (11 Replies)
Discussion started by: necroman08
11 Replies

3. Shell Programming and Scripting

Optional Parameters/arguments while executing a script.

Hello, I have a shell script "Test.ksh" and I need to pass 8 parameters/arguments while executing the script ./Test.ksh 1 2 3 4 5 6 7 8 Out of these I want first 3 to be compulsory and rest 5 to be optional. Can you suggest the way to do this like and also how to pass these optional... (3 Replies)
Discussion started by: indrajit_u
3 Replies

4. Shell Programming and Scripting

using switch on multiple arguments

I have a switch statement, and I want to have two options performing the same thing. For example, if $opt matches "-fb" or "--fbase", I want to perform the same operation. How can I include various matches in "case" ? switch ($opt) case "-T": set Atpath = $par set opt_tpath =... (8 Replies)
Discussion started by: kristinu
8 Replies

5. Shell Programming and Scripting

Usage: optional and mandatory arguments

I have an awk script which can be used in the following ways: xi and xf will only be mandatory when processing the file fin.zc. awk -v xi=0/-0.5 -v xf=80/30 -f ./zc2cmd.awk fin.zc > fout.cmod awk -f ./zc2cmd.awk -u awk -f ./zc2cmd.awk --usg awk -f ./zc2cmd.awk -e awk -f ./zc2cmd.awk... (1 Reply)
Discussion started by: kristinu
1 Replies

6. Shell Programming and Scripting

How to make shell script arguments optional?

Here is my script: #!/bin/ksh usage () { echo " Usage: $0 <opt1> <opt2> <opt3> <opt4>" } if ; then usage exit; fi prog -a $1 -b $2 -c $3 -d $4 2>&1 | tee -a ~/$1.log I want argument 4 to be optional, so if there's no argument for opt4, that it doesn't... (8 Replies)
Discussion started by: guitarscn
8 Replies

7. Programming

Passing arguments from command line to switch case statement in C

Hi Am pretty new to C.. Am trying to pass the arguments from command line and use them in switch case statement.. i have tried the following #include <stdlib.h> main(int argc, char* argv) { int num=0; if ( argc == 2 ) num = argv; printf("%d is the num value",num); switch ( num ) ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

8. Red Hat

Linux Optional Packages

Please forgive but I am new to Linux and still learning. When installing Linux (any flavor) over PXE, it asks if you want to customize which packages to install. Most engineers ask us to install all packages but this entails A LOT of clicking. Is there a way to "select all" packages by using a... (3 Replies)
Discussion started by: svolbruck
3 Replies

9. Shell Programming and Scripting

Getopts with optional parameters

Hi Unix Gurus, i am on learning path of unix, and yet to discover many things. I came across with this requirement where i need to pass parameters but the position of parameters is not fixed so after doing some google search got to know "getopts" can handle that. So here is my code: function... (3 Replies)
Discussion started by: gnnsprapa
3 Replies
SVK::Log::ChangedPaths(3)				User Contributed Perl Documentation				 SVK::Log::ChangedPaths(3)

NAME
SVK::Log::ChangedPaths - partly lazy list of SVK::Log::ChangedPath objects SYNOPSIS
use SVK::Log::ChangedPaths; my $changed_paths = SVK::Log::ChangedPaths->new( $root ); for my $changed_path ( $changed_paths->paths() ) { ... } DESCRIPTION
An object of this class represents a collection of details about the files/directories that were changed in a particular revision. Some log filters want access to information about which paths were affected during a certain revision and others don't. Using this object allows the calculation of path details to be postponed until it's truly needed. METHODS
new Accepts the return value of "SVK::Path->root()" as a parameter and constructs a SVK::Log::ChangedPaths object from it. paths Returns a list of SVK::Log::ChangedPath objects each of which represents the details of the changes to a particular path. DIAGNOSTICS
None CONFIGURATION AND ENVIRONMENT
SVK::Log::ChangedPaths requires no configuration files or environment variables. DEPENDENCIES
o SVK::Log::ChangedPath INCOMPATIBILITIES
None known BUGS AND LIMITATIONS
None known perl v5.10.0 2008-08-04 SVK::Log::ChangedPaths(3)
All times are GMT -4. The time now is 02:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy