I need to read pairs of lines from a file and compare them. We can assume that the number of lines in the file is even. Can i do it in korn shell? (4 Replies)
This seems to be a question whose answer uses sed or awk.
For a file like:
a
b
c
d
e
How to swap the order of the line pairs, to end up with:
b
a
d
c
e
All lines from the original file need to wind up in the output file. (8 Replies)
I have a file that contains 87 lines, each with a set of coordinates (x & y). This file looks like:
1 200.3 -0.3
2 201.7 -0.32
...
87 200.2 -0.314
I have another file which contains data that was taken at certain of these 87 positions. i.e.:
37 125
42 175
86 142
where the first... (1 Reply)
Hi, I have multiple large files which consist of the below format:
I am trying to write an awk or sed script to remove all occurrences of the 00 record except the first and remove all of the 80 records except the last one.
Any help would be greatly appreciated. (10 Replies)
Hi
I need to order these lines from a txt file my file looks like this
IMSI ........................ 1234567890
APN ......................... INTERNET.COM
APN ......................... MMS.COM
APN ......................... WAP.COM
APN ......................... BA.COM
IMSI... (4 Replies)
Hi,
I have a requirement where I need to combine two lines in a file based on first character of each line in a file.
Please find the sample content of the file below:
Code:
_______________________
5, jaya, male, 4-5-90, single
smart
6, prakash, male, 5-4-84, married
fair
7, raghavi,... (1 Reply)
Hi,
I have a requirement where I need to combine two lines in a file based on first character of each line in a file.
Please find the sample content of the file below:
Code:
_______________________
5, jaya, male, 4-5-90, single
smart
6, prakash, male, 5-4-84, married
fair
7, raghavi,... (1 Reply)
Hi All,
i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field.
i am using centos 7 Operating system.
want to read below file.
# cat /tmp/d5
NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 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)