Sponsored Content
Top Forums UNIX for Dummies Questions & Answers File updation on matching key Post 302975220 by Don Cragun on Thursday 9th of June 2016 01:20:17 PM
Old 06-09-2016
I'm glad you got it to work. If you'd like to show us how you changed the code to perform the rounding you wanted, we might be able to offer suggestions for alternative ways to do it. (And, having your completed solution in the thread helps others who may have a similar problem in the future if they can see how you solved the problem.)

If field 8 always 6 characters? Or, can the length of that field vary from file to file too? (Making that field variable length isn't complicated, if the length varies.)

Can the original value in field 8 ever appear as the value of field 2, 3, 4, 5, 6, or 7 in any of your input files? (As long as the 1st field is always left aligned and the aren't any empty fields in your input files, it wouldn't be too hard to be sure that field 8 is modified in the output and not an earlier field with the same contents. But, the code is faster and simpler as provided in RudiC's suggestion if this isn't a concern for your input files.)
 

10 More Discussions You Might Find Interesting

1. Programming

Directory updation Notification?

Hi, I'm a UNIX newbie .. so forgive me if this question sounds dumb. :) Is it possible for Unix to notify a process that a particular directory has been updated? Rather that the process constantly polling the directory ... Awaiting your replies .. Thanks, VJ (6 Replies)
Discussion started by: vjsony
6 Replies

2. Linux

gcc updation on Linux machine

Hi All, I already have gcc complier installed in my machine. Its version is : gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) I am not sure whethere it's is latest gcc version available. I want to update my gcc version. Can anyone please suggest me what is the latest and stable gcc... (1 Reply)
Discussion started by: bisla.yogender
1 Replies

3. Shell Programming and Scripting

Matching by key fields

I have a file (key.dat) that contains two columns: AA|1234| BB|567| CC|8910| I have another file (extract.dat) that contains some data: SD|458|John|Smith| AA|3345|Frank|Williams| AA|1234|Bill|Garner| BD|0098|Yu|Lin| BB|567|Gail|Hansen| CC|8910|Ken|Nielsen| I want to compare the... (5 Replies)
Discussion started by: ChicagoBlues
5 Replies

4. Shell Programming and Scripting

awk should output if one input file doesnt have matching key

nawk -F, 'FNR==NR{a= $3 ;next} $2 in a{print $1, 'Person',$2, a}' OFS=, filea fileb Input filea Input fileb output i am getting : (2 Replies)
Discussion started by: pinnacle
2 Replies

5. AIX

Problem with updation of 'quota'

Hi, We have recently implemented 'quota' concept for the unix users. softlimit - 230MB hardlimit - 250MB We have applied the quota when few of users are more than the hardlimit,issue is that even though the users cleared the space, still its 'quota' was not updating properly. For some... (0 Replies)
Discussion started by: girish_satyam
0 Replies

6. Shell Programming and Scripting

check files updation

Hi All, Can anyone help to write the script to check files updation? i have files as mentioned below. which will be updated some time. i just want to check the last file is updating the data for last 15 mins or not. if its not updating i want to print NOT OK. if its updating data i want... (1 Reply)
Discussion started by: steve2216
1 Replies

7. Shell Programming and Scripting

Config file auto-updation

Hello All, I need to update my .cfg file which is used in the script for almost all runs. myfile.cfg file: var=1 var1=1 run=0 script: #! /bin/sh . /mydir/myfile.cfg echo $var"\t" $var1 exit So, the requirement is that the myfile.cfg should update every time I run the... (10 Replies)
Discussion started by: PikK45
10 Replies

8. Shell Programming and Scripting

Rsa public private key matching

Hi All, I have a requirement where i need to check if an rsa public key corresponds to a private key and hence return success or failure. Currently i am using the command diff <( ssh-keygen -y -e -f "$PRIVKEY" ) <( ssh-keygen -y -e -f "$PUBLICKEY" ) and its solving my purpose. This is in... (1 Reply)
Discussion started by: mritusmoi
1 Replies

9. UNIX for Dummies Questions & Answers

awk - Print lines if only matching key is found

I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but - Currently, script is not printing lines to File3.txt in order. Thanks a lot. Any help is appreciated. Script I am using: awk 'FNR == NR && ! /^]*$/ {... (9 Replies)
Discussion started by: High-T
9 Replies

10. UNIX for Beginners Questions & Answers

Matching 2 files based on key

Hi all I have two files I need to match record from first file and second file on column 1,8 and and output only match records on file1 File1: 020059801803180116130926800002090000800231000245204003160000000002000461OUNCE000000350000100152500BM01007W0000 ... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies
gd_validate(3)							      GETDATA							    gd_validate(3)

NAME
gd_validate -- check a dirfile field code for validity SYNOPSIS
#include <getdata.h> int gd_validate(DIRFILE *dirfile, const char *field_code); DESCRIPTION
The gd_validate() function queries a dirfile(5) database specified by dirfile and checks whether field_code, which may contain a represen- tation suffix, specifies a valid field. The dirfile argument must point to a valid DIRFILE object previously created by a call to gd_open(3). This function checks whether the field and its input fields (if any) are found, whether the representation suffix (if any) is valid, and also that all non-literal parameters specify valid scalar fields. RETURN VALUE
If all checks pass, gd_validate() returns zero. On error, it returns -1 and sets the dirfile error to a non-zero error value. Possible error values are: GD_E_BAD_CODE The field specified by field_code or one of the fields it uses as input was not found in the database. GD_E_BAD_DIRFILE The supplied dirfile was invalid. GD_E_BAD_REPR The representation suffix specified in field_code was not recognised. GD_E_BAD_SCALAR A non-literal scalar used in the definition of the field or one of its inputs was not found, or was not a CONST or CARRAY field. GD_E_DIMENSION A scalar field was found where a vector field was expected. GD_E_RECURSE_LEVEL Too many levels of recursion were encountered while trying to resolve field_code. This usually indicates a circular dependency in field specification in the dirfile. The dirfile error may be retrieved by calling gd_error(3). A descriptive error string for the last error encountered can be obtained from a call to gd_error_string(3). NOTES
It is not necessary to call this function before passing a field code to another GetData function: all functions which accept field codes perform these checks themselves. SEE ALSO
dirfile(5), gd_getdata(3), gd_error(3), gd_error_string(3), gd_open(3) Version 0.7.0 3 November 2010 gd_validate(3)
All times are GMT -4. The time now is 09:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy