Need awk script to compare 2 fields in fixed length file.
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 that have duplicates in a separate file, take that file and look in field 83, if it equals 66 or 88 then delete that line and save to a new file.
I would prefer not to do this in Perl, not many people in this office use or understand Perl. The files format is something like this:
Last edited by vgersh99; 08-25-2009 at 06:12 PM..
Reason: code tags, PLEASE!
To keep the forums high quality for all users, please take the time to format your posts correctly.
First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)
Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.
Thank You.
The UNIX and Linux Forums
---------- Post updated at 05:18 PM ---------- Previous update was at 05:12 PM ----------
Hi ,
I am having a scenario where I need to split the file based on two field values. The file is a fixed length file.
ex:
AA0998703000000000000190510095350019500010005101980301
K 0998703000000000000190510095351019500020005101480 ... (4 Replies)
Hi,
I have a DB2 UDB 9.7 SQL script, as follows:
I need to pass the script into Unix and generate a fixed length file from this.
Can someone kindly provide a script to achieve it?
SELECT
CAST(COALESCE(CL_ID,'000000000') AS CHAR(9)) AS CL_ID
,STATUS... (5 Replies)
Hi,
I need to split a fixed length file of 160 characters based on value of a column. Example:
ABC 456780001 DGDG SDFSF
BCD 444440002 SSSS TTTTT
ABC 777750003 HHHH UUUUU
THH 888880001 FFFF LLLLLL
HHH 999990002 GGGG OOOOO
I need to split this file on basis of column from... (7 Replies)
Hi,
I am in a situation to print the message on a column, where the each line starting position should be same.
For example code:
HOSTNAME1="1.2.3.4.5.6.7"
TARGET_DIR="/tmp"
echo "HOSTNAME1:" "$HOSTNAME1" | awk -v var="Everyone" '{len=55-length;printf("%s%*s\n",$0,len,var)}'
echo... (4 Replies)
HPUX and posix shell
Hi all.
I have a record with fixed length fields....I would like to reorder the fields and preserver the fixed lengths....
cat test
4 960025460 Dept of Music
8 960025248 Dept of Music 12-08
cat... (3 Replies)
Hi, all.
I need to convert a file tab delimited/variable length file in AIX to a fixed lenght file delimited by spaces. This is the input file:
10200002<tab>US$ COM<tab>16/12/2008<tab>2,3775<tab>2,3783
19300978<tab>EURO<tab>16/12/2008<tab>3,28523<tab>3,28657
And this is the expected... (2 Replies)
OK I am somewhat new to UNIX programming please see what you can do to help.
I have a flat file that is a fixed length file containing different records based on the 1st character of each line. The 1st number at the beginning of the line is the record number, in this case it's record #1.
I... (3 Replies)
Hi Unix Champs,
I want to awk on a fixed length file.
Instead if the file was a delimited file, then I could have used -F and then could have easily done manipulation on the fields.
How do i do the same in case of fixed length file?
Thanks in Advance.
Regards. (7 Replies)