07-08-2001
This is a perl method. And am not sure that it does what you mean exactly. Or wait untill someone post another (easiest) way to do the same.
perl -ni.copy -e 'if (/01PUN|01FAM/) { s/^./D/; s/01/02/; print; } else { print; }' InputFile
HTH
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a file with three fields, where the first two fields are of fixed length, left justified, and right padded with spaces. The third field is truncated to the length of the data (max length 5), and possibly contains a single letter. Each field is separated by an additional space. How can I... (1 Reply)
Discussion started by: Duckman
1 Replies
2. Shell Programming and Scripting
num desc ind code
11 hi,feather y food
121 edible,oil y food
100 meal-pack y food
010 health,prod
120 ... (5 Replies)
Discussion started by: thumsup9
5 Replies
3. Shell Programming and Scripting
hi guys,
perhaps you can help me again
I have a file generated with the AIX-tool lparstat the looks like this:
%user %sys %wait %idle physc %entc lbusy app vcsw phint
----- ---- ----- ----- ----- ----- ------ --- ---- -----
21.8 8.8 1.8 67.6 0.17 34.1 9.4 7.22 ... (3 Replies)
Discussion started by: funksen
3 Replies
4. Shell Programming and Scripting
Hi, was hoping someone may be able to help me with a script solution to move one line to another line from my log file:
My log file currently looks like this:
01:21:12:383 Request
01:21:12:639 Response
01:21:12:386 Request
01:21:12:639 Response
01:21:12:389 Request
01:21:12:640 Response... (8 Replies)
Discussion started by: jimbobla
8 Replies
5. Shell Programming and Scripting
Hi ! I'm working into my first bash script to make some xml modification and it's going to make me crazy lol .. so I decide to try into this forum to take some ideas from people that really know about this!
This is my situation I've and xml file with a lots of positional values with another tags... (9 Replies)
Discussion started by: juampal
9 Replies
6. Programming
Hi, I want to read a file from the command line and remove all the spaces, tabs in it, replacing it with comma(,), and write it to a new file. can you help me out with this scenario. (1 Reply)
Discussion started by: sudhanshu12788
1 Replies
7. Shell Programming and Scripting
Hi,
I thought I am getting pretty good with sed and awk, but now I dont have a way out of this question.
I have a table 0.5 16
1.3 14
0.25 15
0.85 16
I want to make a column 3 which contains values that are (corresponding $2 value/sum of all $2).
Please help me out here.
Thanks. (6 Replies)
Discussion started by: jamie_123
6 Replies
8. Shell Programming and Scripting
Below am trying to separate FA-7A:1, In output file it should display 7A 1
Command am using
Gives same output as below format:
22B7 10000000c9720873 0
22B7 10000000c95d5d8b 0
22BB 10000000c97843a2 0
22BB 10000000c975adbd 0
Not showing FA ports as required format... (5 Replies)
Discussion started by: aix_admin_007
5 Replies
9. UNIX for Dummies Questions & Answers
Hi,
After looking at the differents post on this forum, I am convinced that I will benefit from the experience of advanced Unix user on some script I have already done for an aeronautical study. Here is one of them :
Step 1 :
sed -e "s/??/00/g" Base_Awk.txt > Awk_Cut_00.txt4;
sed... (11 Replies)
Discussion started by: Marc_Camoc
11 Replies
10. Shell Programming and Scripting
Hi All
I am having a file as shown below
File1#
modyle 1 {
test jsj
hhsjh 13e3
jsjjs
}
memP(dbg_trace) {
ajjs
jsjs
jsjs
Test(claer) {
jsjs (7 Replies)
Discussion started by: kshitij
7 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)