06-08-2005
using getopt to parse a file
Hi,
can any one tell me how can i use getopt to parse a file just like a command line argument ......
thanks ....
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
scriptname
i have made a script to perform so tasks and i managed to complete the tasks for all the options
the problem i am facing is that i can run the scripts individually but i would like to make it such that it can accept multiple options and give me the appropriate output
e.g.... (1 Reply)
Discussion started by: problems
1 Replies
2. Shell Programming and Scripting
#!/bin/sh
set -- `getopt "abco:" "$@"`
a= b= c= o=
while :
do
case "$1" in
-a) a=1;;
-b) b=1;;
-c) c=1;;
-o) shift; o="$1";;
--) break;;
esac
shift
done
shift # get rid of --
# rest of script...
# e.g.
ls -l $@ (6 Replies)
Discussion started by: Hitori
6 Replies
3. UNIX for Advanced & Expert Users
I have one file say CM.txt which contains values like below.Its just a flat file
1000,A,X
1001,B,Y
1002,B,Z
...
..
total around 4 million lines of entries will be in that file.
Now i need to write another file CM1.txt which should have
1000,1
1001,2
1002,3
....
...
..
Here i... (6 Replies)
Discussion started by: sivasu.india
6 Replies
4. Shell Programming and Scripting
I m trying to use getopt
This is my script, but it doesn't take argument in variable,
Please help.
set - - `getopt mscl: $*`
if
then
echo "Exiting...."
exit 2
fi
for i in $*
do
case $i in
-m) MAIL="$i"; shift;;
-s) SCRIPT=$OPTARG; shift;;
-c) COB=$OPTARG; shift;;... (2 Replies)
Discussion started by: darshakraut
2 Replies
5. Shell Programming and Scripting
:)
Can anybody help me about how to use getopt in shell scripting. (3 Replies)
Discussion started by: darshakraut
3 Replies
6. Solaris
Hi All,
Could anyone tell me how to use getopt command.....?
Thanks,
Pintu (2 Replies)
Discussion started by: pintupatro
2 Replies
7. Shell Programming and Scripting
Hi,
I want to use the getopt function to parse some arguments for a script.
while getopts "i:f:r:" OPTION
do
case $OPTION in
i) iter=$OPTARG;;
f) frame=$OPTARG;;
r) roi=$OPTARG;;
?) echo Usage: ......
exit 2;;
esac
done
However, I... (5 Replies)
Discussion started by: giorgos193
5 Replies
8. Shell Programming and Scripting
Hi
I need to parse the file of same name which exist on different servers and calculate the count of string existed in both files.
Say a file abc.log exist on 2 servers.
I want to search for string "test" on both files and calculate the total count of search string's existence.
For... (6 Replies)
Discussion started by: poweroflinux
6 Replies
9. Shell Programming and Scripting
I am struggling to understand how getopt can be used in a csh script.
can anybody post a csh script using getopt.
Please! (4 Replies)
Discussion started by: animesharma
4 Replies
10. Shell Programming and Scripting
Hi All,
An old work friend wrote a script which I've been trying to understand how a section of it currently works and work out how i can add some command line switches which i can use later in the script to append the output depending on the command line arguements.
Currently it works by... (1 Reply)
Discussion started by: mutley2202
1 Replies