09-01-2007
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi everyone,
Can someone possibly help me with this problem I am having please.
I wrote a Korn shell script to manipulate currency amounts in a way that a person could use this script to determine the minimum number of coins required to make a certain amount.
for example when entered on the... (2 Replies)
Discussion started by: bashirpopal
2 Replies
2. UNIX for Dummies Questions & Answers
I have a script like this--
#!/bin/ksh
echo "To pad a 0 before digits from 1-9"
for i in $*
do
echo $i | sed 's//'0'/g'
done
I run this script as
ksh name 1 2 23 34
The output should be
01 02 23 34
Help me in modifying this script.
Thanks
Namish (2 Replies)
Discussion started by: namishtiwari
2 Replies
3. UNIX for Advanced & Expert Users
Is there a way to repeat the output of the last command for filtering without running the command again? All I could think of was to copy all the data to a text file and process it that way, is there another way? Like say I want to grep server.server.lan from a dtrace that was pages long after I... (5 Replies)
Discussion started by: glev2005
5 Replies
4. Shell Programming and Scripting
My code to "Delete empty files from a directory entered in command promt"
#/bin/sh
echo "Enter directory"
read gh
for file in `ls $gh`
do
# to get the size of file
a=$( ls -l file | awk ' {print $7} ');
echo $a
if
then
echo "removing file "
rm file
fi
done (6 Replies)
Discussion started by: adirajup
6 Replies
5. Shell Programming and Scripting
Say I have a ksh program called test.ksh which has several defined arrays inside it such as array1,array2,array3...These arrays contain strings.
I also have a method in the program:
for x in $1
do
....(#do something)
done
So, when the user enteres: ./test.ksh array1, I want to... (3 Replies)
Discussion started by: mrskittles99
3 Replies
6. Shell Programming and Scripting
How to repeat the execution of a simple command like the following for 1 sec ?
echo Hi
The completion time for the command is not known, but we need to calculate the number of times this commans executes successfully within 1 sec.
Thanks
Kumarjit (5 Replies)
Discussion started by: kumarjt
5 Replies
7. Shell Programming and Scripting
I am trying to create a script that will accept multi input from the user (really just me), then execute those command on a remote device.
My question is if the I enter "No" at the confirmation point "Are these statements correct y or n ?", what is the best way to go back and start over ? I... (3 Replies)
Discussion started by: popeye
3 Replies
8. Shell Programming and Scripting
Hello
Does the unix korn shell provide a function to convert number entered in command line argument to text or Character so that in next step i will convert Chr to Hex (6 Replies)
Discussion started by: aadityapatel198
6 Replies
9. Programming
I came across a site to learn java and they give you practice problems to do. I was wondering if anyone can help me with this since I am totally new to Java. Here is the first problem:
Write a program that will read in a name from the command line and write it out 100 times.
Thank you for any... (10 Replies)
Discussion started by: totoro125
10 Replies
10. UNIX for Dummies Questions & Answers
Assume i have typed 4 commands in the past like
vi `ls -t |head -n 1`
tail -2 test.txt
ls -lrt | grep "/etc/profile.d"
pwd
Now if i type r p it should execute the command "pwd" likewise r t should execute tail -2 test.txt.
Note: esc k and using up arrow and down arrow will get this work... (3 Replies)
Discussion started by: Ramanareddygv
3 Replies
LEARN ABOUT DEBIAN
perl::critic::policy::regularexpressions::prohibitcomplexregexes
Perl::Critic::Policy::RegularExpressions::ProhibitCompleUsereContributed PerlPerl::Critic::Policy::RegularExpressions::ProhibitComplexRegexes(3pm)
NAME
Perl::Critic::Policy::RegularExpressions::ProhibitComplexRegexes - Split long regexps into smaller "qr//" chunks.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Big regexps are hard to read, perhaps even the hardest part of Perl. A good practice to write digestible chunks of regexp and put them
together. This policy flags any regexp that is longer than "N" characters, where "N" is a configurable value that defaults to 60. If the
regexp uses the "x" flag, then the length is computed after parsing out any comments or whitespace.
Unfortunately the use of descriptive (and therefore longish) variable names can cause regexps to be in violation of this policy, so
interpolated variables are counted as 4 characters no matter how long their names actually are.
CASE STUDY
As an example, look at the regexp used to match email addresses in Email::Valid::Loose (tweaked lightly to wrap for POD)
(?x-ism:(?:[^( 40)<>@,;:".\[] 00- 37x80-xff]+(?![^( 40)<>@,;:".\[]
00- 37x80-xff])|"[^\x80-xff
15"]*(?:\[^x80-xff][^\x80-xff
15
"]*)*")(?:(?:[^( 40)<>@,;:".\[] 00- 37x80-xff]+(?![^( 40)<>@,;:".\[
] 00- 37x80-xff])|"[^\x80-xff
15"]*(?:\[^x80-xff][^\x80-xff
15"]*)*")|.)*@(?:[^( 40)<>@,;:".\[] 00- 37x80-xff]+(?![^( 40)<>@,
;:".\[] 00- 37x80-xff])|[(?:[^\x80-xff
15[]]|\[^x80-xff])*]
)(?:.(?:[^( 40)<>@,;:".\[] 00- 37x80-xff]+(?![^( 40)<>@,;:".\[] 00
- 37x80-xff])|[(?:[^\x80-xff
15[]]|\[^x80-xff])*]))*)
which is constructed from the following code:
my $esc = '\\';
my $period = '.';
my $space = '