10-11-2013
another question, how can I make sure that the month and day variable will have fixed two digit value.
Example:
Y=2013
M=3
D=9
How can I change those(M=3, D=9) to two digit (03, 09) and be sure that when the input is for example M=11, D=23 the output won't be M=011 and D=023
Thanks.
---------- Post updated at 09:25 PM ---------- Previous update was at 08:59 PM ----------
actually, don't mind this, I already got it. Thanks again nice people!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Another newbie to Unix scripting Q..
How do you assign a value resulting from a command, such as awk, to a variable.
I am currently trying:-
$awk '{print $1}' file1 > variable1
with no change to $variable1.
The line:
$awk '{print $1}' file1
does print the first line of the... (3 Replies)
Discussion started by: sirtrancealot
3 Replies
2. Shell Programming and Scripting
Hi
In my shell script, I'm trying to find the line count of a file and assign it to a variable.
LINE_COUNT=$(wc -l $FILE_NAME)
But when i display LINE_COUNT, i'm getting the linecount concatenated with the file name. I want only the number. How can i get the line count alone ? Someone... (2 Replies)
Discussion started by: janemary.a
2 Replies
3. Shell Programming and Scripting
hi all,
in ksh, how do i assign the output of a find command to a variable, e.g
am trying something like this :
totalNoFiles=$(print find ./ -name "SystemOut*.log");
but when i echo $totalNoFiles it displays
find ./ -name "SystemOut*.log"
instead of the total number of... (2 Replies)
Discussion started by: cesarNZ
2 Replies
4. Shell Programming and Scripting
can we make a global variable and store character values and add other values to that variable ?? for example
a="hello, John"
and can we add value ". How are you? so
a can have
"hello, John. How are you?"
can someone help me?? (2 Replies)
Discussion started by: bonosungho
2 Replies
5. Shell Programming and Scripting
Is there any difference between:
set variable=39 and variable=39 (1 Reply)
Discussion started by: proactiveaditya
1 Replies
6. Shell Programming and Scripting
Hi folks.
I have this variable called FirstIN that contains something like this: 001,002,003,004...
I am trying to assign the content of this variable into ModifiedIN but with the following format : 001 002 003 004...(changing the commas for spaces)
I thought about using sed but i am not... (17 Replies)
Discussion started by: Stephan
17 Replies
7. Shell Programming and Scripting
my script is some thing like this
i11="{1,2,3,4,5,6,7,8,9,10,11,}"
echo "enter value"
read value ..............suppose i11
x="$value"
echo "$($value)" .............the echo should be {1,2,3,4,5,6,7,8,9,10,11,}
but its showing "i11" only.
plz help me out to get desired... (10 Replies)
Discussion started by: sagar_1986
10 Replies
8. Shell Programming and Scripting
Hi,
I have a list of files in a directory. Each file has a .txt and a .log extension i.e. file.txt & file.log, file1.txt & file1.log etc. The file with the .log extension may not always exist alongside the file with the .txt extension.
I need to copy the .txt file if there is a corresponding... (6 Replies)
Discussion started by: brunlea
6 Replies
9. Shell Programming and Scripting
Unable to get the value to a variable.
set -x
cd $HOME
echo "Enter the server name"
read a
echo $a
i=4
j=1
k = ps -ef | awk '/server1/{ print $4 }' | tail -$i | head -$j`
echo $k
When I do the same in command line it works, however the same does not work when I provide that in the... (1 Reply)
Discussion started by: venkidhadha
1 Replies
10. Shell Programming and Scripting
I have a date column as 06302015 but I need to have variable which extracts 063015.
Am trying something like below but it is not assigning
Please let me know if am missing something. Thanks in advance.
################################
#!/usr/bin/ksh
DT=06302015
... (7 Replies)
Discussion started by: weknowd
7 Replies
LEARN ABOUT DEBIAN
data::formvalidator::constraints::dates
Data::FormValidator::Constraints::Dates(3pm) User Contributed Perl Documentation Data::FormValidator::Constraints::Dates(3pm)
NAME
Data::FormValidator::Constraints::Dates - Validate Dates and Times
SYNOPSIS
use Data::FormValidator::Constraints::Dates qw(date_and_time);
# In a DFV profile...
constraint_methods => {
# 'pp' denotes AM|PM for 12 hour representation
my_time_field => date_and_time('MM/DD/YYYY hh:mm:ss pp'),
}
DESCRIPTION
date_and_time
Note: This is a new module is a new addition to Data::FormValidator and is should be considered "Beta".
This constraint creates a regular expression based on the format string passed in to validate your date against. It understands the
following symbols:
Y year (numeric)
M month (numeric)
D day (numeric)
h hour
m minute
s second
p AM|PM
Other parts of the string become part of the regular expression, so you can do perlish things like this to create more complex expressions:
'MM?/DD?/YYYY|YYYY-MM?-DD?'
Internally Date::Calc is used to test the functions.
BACKWARDS COMPATIBILITY
This older, more awkward interface is supported:
# In a Data::FormValidator Profile:
validator_packages => [qw(Data::FormValidator::Constraints::Dates)],
constraints => {
date_and_time_field => {
constraint_method => 'date_and_time',
params=>['MM/DD/YYYY hh:mm:ss pp'], # 'pp' denotes AM|PM for 12 hour representation
},
}
SEE ALSO
o Data::FormValidator
o Data::FormValidator::Constraints::DateTime - This alternative features returning dates as DateTime objects and validating against the
date formats required for the MySQL and PostgreSQL databases.
AUTHOR
Mark Stosberg, <mark@summersault.com>
Featuring clever code by Jan Krynicky.
COPYRIGHT AND LICENSE
Copyright 2003-2005 by Mark Stosberg
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2011-11-25 Data::FormValidator::Constraints::Dates(3pm)