Working with field increments


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Working with field increments
# 1  
Old 03-03-2007
Working with field increments

I have a new challenge that I need some help with. Each morning I have two files that contain working units and failed units that I join together to form file3 which is FTP to server for comparison against billing system.

My problem, I would like to take joined data in file3 and add a field that would increase the count by 1 for any unit found to be a failed unit. The count would continue until the failed unit is removed, which could be in excess of 365 days or next day. Both failed and working files change daily.

File1 working units change daily but average around 125,000 and file2 failed unit's average 25,000, totaling 150,000 records in file3. I will use cron to run script daily.

Sample file3 output current:

123xxx|123xxx|123xxx|123xxx|123xxx|current field|
123xxx|123xxx|123xxx|123xxx|123xxx|current field|
123xxx|123xxx|123xxx|123xxx|123xxx|current field|

New file3 output:

123xxx|123xxx|123xxx|123xxx|123xxx|current field|failed count days
123xxx|123xxx|123xxx|123xxx|123xxx|current field| 1
123xxx|123xxx|123xxx|123xxx|123xxx|current field| 2
123xxx|123xxx|123xxx|123xxx|123xxx|current field| 34
123xxx|123xxx|123xxx|123xxx|123xxx|current field| 57
123xxx|123xxx|123xxx|123xxx|123xxx|current field| 365
# 2  
Old 03-03-2007
What does the input look like?

Last edited by reborg; 03-03-2007 at 08:23 PM.. Reason: remove useless quoting of previous post
# 3  
Old 03-03-2007
00:00:00:00:00:00|macaddress|10.xx.xx.xxx|31|2|xx00|25|part100001|
00:00:00:00:00:00|macaddress|10.xx.xx.xxx|32|4|x100|14|part100002|
00:00:00:00:00:00|macaddress|10.xx.xx.xxx|37|6|x150|10|part100003|
00:00:00:00:00:00|macaddress|10.xx.xx.xxx|41|5|x200|25|part100004|
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk field separator not working

Hi, can some some help to get me the right results, I have few text files, need to grep few columns from each file and get the results in one row with comma separated. my code is #folder=/nz/kit/log/backupsvr folder=/export/home/nz/valai/tmpfiles/ echo $folder for entry in `ls... (4 Replies)
Discussion started by: ValaiG
4 Replies

2. Shell Programming and Scripting

Display combination of 4 field uniqe record and along with concatenate 5th and 6th field.

Table ACN|NAME|CITY|CTY|NO1|NO2 115|AKKK|ASH|IND|10|15 115|AKKK|ASH|IND|20|20 115|AKKK|ASH|IND|30|35 115|AKKK|ASH|IND|30|35 112|ABC|FL|USA|15|15 112|ABC|FL|USA|25|20 112|ABC|FL|USA|25|45 i have written shell script using cut command and awk programming getting error correct it and add... (5 Replies)
Discussion started by: udhal
5 Replies

3. Programming

Celisus & fahrenheit table converter with fields + increments

no longer needed, please delete thread. (0 Replies)
Discussion started by: xtina
0 Replies

4. Shell Programming and Scripting

Lookup field values in two fixed format file in UNIX - not working

I have 2 fixed length files input#1 & input#2. I want to match the rows based on the value in position 37-50 in both files (pos 37-50 will have same value in both files). If any matching record is found then cut the value against company code & Invoice number from input file #1 (position 99 until... (3 Replies)
Discussion started by: Lingaraju
3 Replies

5. Shell Programming and Scripting

AWK: Pattern match between 2 files, then compare a field in file1 as > or < field in file2

First, thanks for the help in previous posts... couldn't have gotten where I am now without it! So here is what I have, I use AWK to match $1 and $2 as 1 string in file1 to $1 and $2 as 1 string in file2. Now I'm wondering if I can extend this AWK command to incorporate the following: If $1... (4 Replies)
Discussion started by: right_coaster
4 Replies

6. Shell Programming and Scripting

Increments in a loop

Hi All, I am trying to implement a for loop in a .sh file and execute it. My for loop is for i in 1, 200, 400, 600, 800, 1000, 1200,......100000 do ... .. .. done As you could see there is an increment of 200 in each for loop until it reaches 100,000 Instead of specifying all the... (8 Replies)
Discussion started by: Lucky Ali
8 Replies

7. Shell Programming and Scripting

Averaging in increments using awk & head/tail

Hi, I only have a very limited understanding and experience with writing code and I was hoping I could get some help. I have a dataset of two columns (txt format, numbers in each row separated by a tab) Eg. 1 5 2 5 3 6 4 7 5 6 6 6 7 ... (5 Replies)
Discussion started by: Emred_Skye
5 Replies

8. Shell Programming and Scripting

Sort alpha on 1st field, numerical on 2nd field (sci notation)

I want to sort alphabetically on the first field and sort in descending numerical order on the 2nd field. With a normal "sort -r -n" it does this: abc ||| 5e-05 ||| bla abc ||| 3 ||| ble def ||| 1 ||| abc def ||| 0.2 ||| def As you can see it ignores the fact that 5e-05 is actually 0.00005... (1 Reply)
Discussion started by: FrancoisCN
1 Replies

9. UNIX for Dummies Questions & Answers

Want to process file in 1000 record increments

I have a file that varies in the # of records. I want to read 1000 records, do something, read the next 1000 records, do something, going in 1000 increment chunks, and then finish up with whatever is left over at end of file. (1 Reply)
Discussion started by: Tsamp
1 Replies

10. Programming

ip address octet increments

Hi all, Situation is as below. I would get an IP address and port from eithe r a file or command line. It probably would be as char * or string. So was wondering how I could accept this and increment the last octets? Incrementing the port is fine. I could get that into an integer by atoi()... (8 Replies)
Discussion started by: Naanu
8 Replies
Login or Register to Ask a Question