11-12-2005
scripting....guru's help needed
perl guru's,
what i think is, not simply writing a script...i like to write a script which must take less time to run and less memory use..i like to fine tune my program...
for ex, my program has a subroutine(1 file open &file close and 1print )
2if loops(1 file open &file close and 3print ) and a while loop with split, chomp
3system cmd's, 2if loops..like that..
i like to know:
1).in perl what statements will use less cpu, memory, time to run...
what loops or statments or what are all the things one programmer should try to avoid and what should be included...what r all the best practices?...
2). is that same for perl in both unix and windows?..
3).whether those rules or ideas r same to unix shell scriptiing or not?
thanks in advance..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Well I have a new hosting account. I love these guys, because they have everything I need, and give me everything I need, but at the cost of I must configure it myself. I am trying to create a subdomain, and they use raw zone access for dns administration. I have no idea how to configure the zone... (1 Reply)
Discussion started by: btmitch
1 Replies
2. Shell Programming and Scripting
can someone pls help me with the script for a files coming from one system to a particular directory and i want to write a script to move those files to another directory on different system by renaming the files...
pls someone help me on this...
thanking in anticipation.... (1 Reply)
Discussion started by: thatiprashant
1 Replies
3. Shell Programming and Scripting
guys i need bit of help!!
i am writing a script which finds files that have not been accessed for a no of days and delete those files...the no of days value is inputted at the command line....
i am using the following :
find $1 -atime +7 -exec rm -i
in the second step i want to copy all... (2 Replies)
Discussion started by: vats
2 Replies
4. Shell Programming and Scripting
Hello fellas or ladies.
I am new on this site and new to the unix operating system. I have been working with UNIX and i love it so far, i learned some stuff and most of the beneficiary command but I need help renaming all the files in my directory and doing them one by one is just tiring.... (1 Reply)
Discussion started by: keyboardkowboy
1 Replies
5. Shell Programming and Scripting
Hello Friends,
I am very new to scripting and currently have come across a situation where I need to create a UNIX script which would look for certain text in a file and then email me if it finds it.
I am trying to trouble shoot an issue with our internet websites and I need to know when I... (1 Reply)
Discussion started by: mahive
1 Replies
6. Homework & Coursework Questions
Hi,
My task is to check the file test.txt every 15 min from Mon-Fri 9:00AM - 6:00PM. We get this file from our mainframes, every 15 min it will update the same file.
My task is to compare file timestamp with current system time stamp and check if the file is updated or not.
If the file doesn't... (0 Replies)
Discussion started by: chinniforu2003
0 Replies
7. Shell Programming and Scripting
Hello all! Please help me with the following complex regexp which works in egrep:
egrep '\"http:\/\/ccc\.bbb\.com\/documents\/0000\/{4}\/(+\.{3})*\"' my-file.htmlBut silently does not work in sed:
sed "s/\"http:\/\/ccc\.bbb\.com\/documents\/0000\/{4}\/(+\.{3})*\"/aaa/g" my-file.htmlor
sed... (7 Replies)
Discussion started by: ulrith
7 Replies
8. Shell Programming and Scripting
Hi All,
I have a conf file and it has two entries seperated by comma, look like :-
best1,ls /opt/bmc/Patrol3/*/best1
......, .......................
In which "Best1" is the product name and "ls /opt/bmc/Patrol3/*/best1" is the way to find the product version of Best1 in that particular... (5 Replies)
Discussion started by: Renjesh
5 Replies
9. Shell Programming and Scripting
Hi Guys,
I need help in scripting out the below :
this is a sample data i have in my file:
jobname type 8:00:00 AM
I need to remove the ":00" from the time field alone.
Thanks in advance for all ur help (8 Replies)
Discussion started by: a12ka4
8 Replies
10. Shell Programming and Scripting
Hi folks,
need a small help
lets say i have a text file with the following content:
james
tom
jack
spielberg
i want to append text to the beginning of each line with a variable(lets says FirName:) and i want to combine all the names with a space in between and store it in another... (11 Replies)
Discussion started by: tech_frk
11 Replies
LEARN ABOUT OPENDARWIN
shift
shift(1) User Commands shift(1)
NAME
shift - shell built-in function to traverse either a shell's argument list or a list of field-separated words
SYNOPSIS
sh
shift [n]
csh
shift [variable]
ksh
* shift [n]
DESCRIPTION
sh
The positional parameters from $n+1 ... are renamed $1 ... . If n is not given, it is assumed to be 1.
csh
The components of argv, or variable, if supplied, are shifted to the left, discarding the first component. It is an error for the variable
not to be set or to have a null value.
ksh
The positional parameters from $n+1 $n+1 ... are renamed $1 ..., default n is 1. The parameter n can be any arithmetic expression that
evaluates to a non-negative number less than or equal to $#.
On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways:
1. Variable assignment lists preceding the command remain in effect when the command completes.
2. I/O redirections are processed after variable assignments.
3. Errors cause a script that contains them to abort.
4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari-
able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not
performed.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
csh(1), ksh(1), sh(1), attributes(5)
SunOS 5.10 15 Apr 1994 shift(1)