Link to home
Start Free TrialLog in
Avatar of Aquamarine77
Aquamarine77

asked on

help write a unix script to compare and print two numeric fields

Hi,
I have a text file that contains 2 columns of numbers which are comma delimited, here is a sample
column1, column2
319290 ,319292        
319328 ,319329        
319358 ,319358
312       ,316      
319450 ,319451
I need a unix script that does the following:
1) check the length of the number in the first column if it is not equal to  6 digits put "0" instead of the missing digit like 312 in the sample above would be 312000
2) then check the length of the number in the second column number if it is not equal to 6 digits, replace the missing digit/digits with 9 so the 316 in second column would be 316999

3)compare  both the numbers in column 1 and 2 and if the number in column 2 is greater than the one in column 1  break the range and print all the numbers for example
column1, column2
319290 ,319292    
I want the script to print the whole range like this:
319290
319291
319292
finally want to put output of this in another text file called routes.

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial