I have a file number.txt.I need to get 2 inputs from the terminal like a=100 and b=200.If a and b are there in the file,then check if a < b,print "less".If a is not there in the file,print "a is missing" or if b is not there in the file,print "b is missing".
number.txt:
Last edited by Don Cragun; 10-13-2015 at 11:16 PM..
Reason: Add CODE and ICODE tags.
guys,
I am trying to write a script that does the following:
it looks for a file in a specific directory and if the file is not there (NOT), it emails me. I have tried the following but its not working. It simply hangs up. Please help.
if
then
mail -s 'blah blah blah' my email... (4 Replies)
Hi. I'd like to have an IF-Then-Else statement where I can check to see if a file exists? We have the Bourne Shell by default. I'm looking for the syntax to do something like this:
if myfile.txt exists then
...my code
else
...my code
end if
Any help would be greatly... (5 Replies)
Hi,
I am trying to write a script which checks if any file exists with "*.log" or "*.out" in Directory
below is the code
#------------------
path=/abd/xyz/
if ; then
echo "Good"
else
echo "Failure"
fi
#--------------------------
its always going to else part and printing... (8 Replies)
I want to write a script to see if various files exist. What I want to do is have the script search in various directories if a file exist, and if not, then output something like "/path/file does not exist". I don't actually know of how to check and see if a file exists or not. What I have in mind... (2 Replies)
I want to perform SQL *Loader operation only if a file named "load.txt" exists in a directory "/home/loc/etc". Please help how to check this with a if condition. (8 Replies)
Hi
#Testing for file existence
if ; then
echo 'SCHOOL data is available for processing'
else
echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING'
:
i wrote a script, where it begins by checking if file exists or not.
If it exists, it truncates the database... (2 Replies)
Hi,
I want to check if the file exists or not in the directory.
i am trying below code but not working.
File="/home/va59657/Account_20090213*.dat"
echo "$File"
if ]; then
echo "file found"
else
echo "file not found"
fi
However i am getting file not found even if file exits as... (5 Replies)
bash in RHEL 6.3
I have these 2 files with strings.
$ cat someStrings.txt
LOGICAL1
HUNGARY2
PENGUIN2
MOBILE
GUITAR1
MOUSE1
$$ cat checkIF.txt
PENGUIN
MOBILE
$I need to search for strings in someStrings.txt file that matches the patterns in checkIF.txt file.
The strings in... (7 Replies)
Hi,
I have the below code written. However I am not getting the desired output
I am checking if the particular path has file in it.
#!/bin/bash
ls -l /IRS2/IRS2_ODI/INFILE/*LS* 1>/dev/null 2>/dev/null
if
then
echo $?
echo "File Exists"
fi
... (3 Replies)
I need to check whether a file exists and has been changed.
The file should contain a specific string. The file should also have been changed within the last ten seconds.
How do I do that? (3 Replies)
Discussion started by: locoroco
3 Replies
LEARN ABOUT DEBIAN
formvalidator::simple::results
FormValidator::Simple::Results(3pm) User Contributed Perl Documentation FormValidator::Simple::Results(3pm)NAME
FormValidator::Simple::Results - results of validation
SYNOPSIS
my $results = FormValidator::Simple->check( $req => [
name => [qw/NOT_BLANK ASCII/, [qw/LENGTH 0 10/] ],
email => [qw/NOT_BLANK EMAIL_LOOSE/, [qw/LENGTH 0 30/] ],
] );
if ( $results->has_error ) {
foreach my $key ( @{ $results->error() } ) {
foreach my $type ( @{ $results->erorr($key) } ) {
print "invalid: $key - $type
";
}
}
}
DESCRIPTION
This is for handling resuls of FormValidator::Simple's check.
This object behaves like Data::FormValidator's results object, but has some specific methods.
CHECK RESULT
has_missing
If there are missing values ( failed in validation 'NOT_BLANK' ), this method returns true.
if ( $results->has_missing ) {
...
}
has_invalid
If there are invalid values ( failed in some validations except 'NOT_BLANK' ), this method returns true.
if ( $results->has_invalid ) {
...
}
has_error
If there are missing or invalid values, this method returns true.
if ( $results->has_error ) {
...
}
success
inverse of has_error
unless ( $resuls->success ) {
...
}
ANALYZING RESULTS
missing
no argument
When you call this method with no argument, it returns keys failed 'NOT_BLANK' validation.
my $missings = $results->missing;
foreach my $missing_data ( @$missings ) {
print $missing_data, "
";
}
# -- print out, for example --
# name
# email
key When you call this method with key-name, it returnes true if the value of the key is missing.
if ( $results->missing('name') ) {
print "name is empty!
";
}
invalid
no argument
When you call this method with no argument, it returns keys that failed some validation except 'NOT_BLANK'.
my $invalids = $results->invalid;
foreach my $invalid_data ( @$invalids ) {
print $invalid_data, "
";
}
# -- print out, for example --
# name
# email
key When you call this method with key-name, it returns names of failed validation.
my $failed_validations = $results->invalid('name');
foreach my $validation ( @$failed_validations ) {
print $validation, "
";
}
# -- print out, for example --
# ASCII
# LENGTH
key and validation-name
When you call this method with key-name, it returns false if the value has passed the validation.
if ( $results->invalid( name => 'LENGTH' ) ) {
print "name is wrong length!
";
}
error
This doesn't distinguish 'missing' and 'invalid'. You can use this like 'invalid' method, but this consider 'NOT_BLANK' same as other
validations.
my $error_keys = $results->error;
my $failed_validation = $resuls->error('name');
# this includes 'NOT_BLANK'
if ( $results->error( name => 'NOT_BLANK' ) ) {
print "name is missing!
";
}
if ( $results->error( name => 'ASCII' ) ) {
print "name should be ascii code!
";
}
SEE ALSO
FormValidator::Simple
AUTHOR
Lyo Kato <lyo.kato@gmail.com>
COPYRIGHT AND LICENSE
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-12-08 FormValidator::Simple::Results(3pm)