I have input file like Input.dat with below content
Here 3 column is the key column and 7th and 9th are the value columns. I want to do some arithematic operations on 7th & 9th column and update that
value to 8th column on matching of 3rd key column.
example : here first two row has same key column(3rd column) (9000100001) so I want to do
((((7th column value + 9th column value)of row 1)+((7th column value + 9th column value)of row 2))/2)
ie (((2+4)+(3+3))/2)=000006 (leading zeros for complete 6 digit number)
so i have to update the first 2 rows(key is 9000100001)of origal Input.dat files 8th column with 000006 value
So final output of above example is as
I have done script for this requirement as below : Final_Count.sh
and output is :
--- Count_output.dat---
---------------- Final_updated.dat --------------
----------------------------------------------------
-------------------------------------------------------------------------------------------------------------------
Here in this script for final updated file I am using static printing like
so here I am printing spaces after column value manually. I want this as dynamic.
In short print all column with as it is(with space) and just update 8th column.
Please can you help me with this ?
Last edited by Don Cragun; 06-09-2016 at 02:46 AM..
Reason: Add CODE and ICODE tags.
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)
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)
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)
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)
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)
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)
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)
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)
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)