02-17-2020
Please help with Linux script to compare file two fields values
I need to compare two dates for each line of the .txt file. If value in position 11 is equal to ‘02407' and ‘21100220' minus ‘19860220' equal to 124 years I want to bypass this record, otherwise I want this record written to the output.
This is a sample data in the file:
19860220 02407 21100220
19660121 02501 20200218
19670301 02501 20200218
19880420 03105
I am trying to accomplish this with SED or AWK command.
Last edited by mamtsism; 02-19-2020 at 10:58 AM..
Reason: To show data and change post details.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Need a script that manipulates a fixed length file that will compare 2 fields in that file and if they are equal write that line to a new file.
i.e. If fields 87-93 = fields 119-125, then write the entire line to a new file. Do this for every line in the file. After we get only the fields... (1 Reply)
Discussion started by: Muga801
1 Replies
2. UNIX for Advanced & Expert Users
Hi All,
I have two files
file1:
abc,def,ghi,5,jkl,mno
pqr,stu,ghi,10,vwx,xyz
cba,ust,ihg,4,cdu,oqw
file2:
ravi,def,kishore
ramu,ust,krishna
joseph,stu,mike
I need two output files as follows
In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Discussion started by: yerruhari
1 Replies
3. UNIX for Dummies Questions & Answers
Hi All,
I have two files
file1:
abc,def,ghi,5,jkl,mno
pqr,stu,ghi,10,vwx,xyz
cba,ust,ihg,4,cdu,oqw
file2:
ravi,def,kishore
ramu,ust,krishna
joseph,stu,mike
I need two output files as follows
In my above example, each row in file1 has 6 fields and each row in file2 has 3... (1 Reply)
Discussion started by: yerruhari
1 Replies
4. Shell Programming and Scripting
Hi All,
I have two files
file1:
abc,def,ghi,5,jkl,mno
pqr,stu,ghi,10,vwx,xyz
cba,ust,ihg,4,cdu,oqw
file2:
ravi,def,kishore
ramu,ust,krishna
joseph,stu,mike
I need two output files as follows
In my above example, each row in file1 has 6 fields and each row in file2 has 3... (3 Replies)
Discussion started by: yerruhari
3 Replies
5. Shell Programming and Scripting
Hi All,
I have two files and data looks like this:
File1 Contents
#Field1,Field2
Dist_Center_file1.txt;21
Dist_Center_file3.txt;20
Dist_Center_file2.txt;20
File2 Contents (*** No Header ***)
Dist_Center_file1.txt;23
Dist_Center_file2.txt;20
Dist_Center_file3.txt;20
I have... (4 Replies)
Discussion started by: Hangman2
4 Replies
6. Shell Programming and Scripting
- I have two files (File 1 and File 2) and the contents of the files are mentioned below.
- I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2.
- I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies
7. UNIX for Dummies Questions & Answers
Hi all !
If there is only one single value in a column (e.g. column 1 below), then return this value in the same output column.
If there are several values in the same column (e.g. column 2 below), then return the different values separated by "," in the output.
pipe-separated input:
... (11 Replies)
Discussion started by: lucasvs
11 Replies
8. Shell Programming and Scripting
Hi All,
I have a requirement where I need to compare 2 files & if the values in the files match, it should proceed, else exit the script without proceeding further.
For e.g : Scenario 1
In this case, the script should exit without proceeding further.
Scenario 2
In this case, the script... (7 Replies)
Discussion started by: dsfreddie
7 Replies
9. UNIX for Advanced & Expert Users
Hello,
I am working parsing a large input file1(field CFA)
I have to compare the the file1 field(CFA byte 88-96) with the content of the file2(It contains only one field) and and insert rows equal
in another file.
Here is my code and sample input file:
... (7 Replies)
Discussion started by: GERMANOS
7 Replies
10. Programming
Hi Experts,
I am working one one python script in version 3.x and 2.6. Need your support to complete it
Basically for both commands i have telnet to device and run command and then receiving input File 1 and File 2
I have two commands, need to grep data and output in csv file.
Next script/code... (0 Replies)
Discussion started by: as7951
0 Replies
LEARN ABOUT CENTOS
address
Address(3pm) User Contributed Perl Documentation Address(3pm)
NAME
Palm::Address - Handler for Palm AddressBook databases
SYNOPSIS
use Palm::Address;
DESCRIPTION
The Address PDB handler is a helper class for the Palm::PDB package. It parses AddressBook databases.
AppInfo block
The AppInfo block begins with standard category support. See Palm::StdAppInfo for details.
Other fields include:
$pdb->{appinfo}{lastUniqueID}
$pdb->{appinfo}{dirtyFields}
I don't know what these are.
$pdb->{appinfo}{fieldLabels}{name}
$pdb->{appinfo}{fieldLabels}{firstName}
$pdb->{appinfo}{fieldLabels}{company}
$pdb->{appinfo}{fieldLabels}{phone1}
$pdb->{appinfo}{fieldLabels}{phone2}
$pdb->{appinfo}{fieldLabels}{phone3}
$pdb->{appinfo}{fieldLabels}{phone4}
$pdb->{appinfo}{fieldLabels}{phone5}
$pdb->{appinfo}{fieldLabels}{phone6}
$pdb->{appinfo}{fieldLabels}{phone7}
$pdb->{appinfo}{fieldLabels}{phone8}
$pdb->{appinfo}{fieldLabels}{address}
$pdb->{appinfo}{fieldLabels}{city}
$pdb->{appinfo}{fieldLabels}{state}
$pdb->{appinfo}{fieldLabels}{zipCode}
$pdb->{appinfo}{fieldLabels}{country}
$pdb->{appinfo}{fieldLabels}{title}
$pdb->{appinfo}{fieldLabels}{custom1}
$pdb->{appinfo}{fieldLabels}{custom2}
$pdb->{appinfo}{fieldLabels}{custom3}
$pdb->{appinfo}{fieldLabels}{custom4}
$pdb->{appinfo}{fieldLabels}{note}
These are the names of the various fields in the address record.
$pdb->{appinfo}{country}
An integer: the code for the country for which these labels were designed. The country name is available as
$Palm::Address::countries[$pdb->{appinfo}{country}];
$pdb->{appinfo}{misc}
An integer. The least-significant bit is a flag that indicates whether the database should be sorted by company. The other bits are
reserved.
Sort block
$pdb->{sort}
This is a scalar, the raw data of the sort block.
Records
$record = $pdb->{records}[N];
$record->{fields}{name}
$record->{fields}{firstName}
$record->{fields}{company}
$record->{fields}{phone1}
$record->{fields}{phone2}
$record->{fields}{phone3}
$record->{fields}{phone4}
$record->{fields}{phone5}
$record->{fields}{address}
$record->{fields}{city}
$record->{fields}{state}
$record->{fields}{zipCode}
$record->{fields}{country}
$record->{fields}{title}
$record->{fields}{custom1}
$record->{fields}{custom2}
$record->{fields}{custom3}
$record->{fields}{custom4}
$record->{fields}{note}
These are scalars, the values of the various address book fields.
$record->{phoneLabel}{phone1}
$record->{phoneLabel}{phone2}
$record->{phoneLabel}{phone3}
$record->{phoneLabel}{phone4}
$record->{phoneLabel}{phone5}
Most fields in an AddressBook record are straightforward: the "name" field always gives the person's last name.
The "phoneN" fields, on the other hand, can mean different things in different records. There are five such fields in each record, each of
which can take on one of eight different values: "Work", "Home", "Fax", "Other", "E-mail", "Main", "Pager" and "Mobile".
The $record->{phoneLabel}{phone*} fields are integers. Each one is an index into @Palm::Address::phoneLabels, and indicates which
particular type of phone number each of the $record->{phone*} fields represents.
$record->{phoneLabel}{display}
Like the phone* fields above, this is an index into @Palm::Address::phoneLabels. It indicates which of the phone* fields to display in the
list view.
$record->{phoneLabel}{reserved}
I don't know what this is.
METHODS
new
$pdb = new Palm::Address;
Create a new PDB, initialized with the various Palm::Address fields and an empty record list.
Use this method if you're creating an Address PDB from scratch.
new_Record
$record = $pdb->new_Record;
Creates a new Address record, with blank values for all of the fields. The AppInfo block will contain only an "Unfiled" category, with ID
0.
"new_Record" does not add the new record to $pdb. For that, you want "$pdb->append_Record".
SOURCE CONTROL
The source is in Github:
http://github.com/briandfoy/p5-Palm/tree/master
AUTHOR
Alessandro Zummo, "<a.zummo@towertech.it>"
Currently maintained by brian d foy, "<bdfoy@cpan.org>"
SEE ALSO
Palm::PDB(3)
Palm::StdAppInfo(3)
BUGS
The new() method initializes the AppInfo block with English labels and "United States" as the country.
perl v5.10.1 2010-02-23 Address(3pm)