Mark Gritter (markgritter) wrote,
Mark Gritter

Wanted: Text File Join

Right now I've got a data file containing a frequency distribution that looks something like this:

23450 0.001
172385 0.0009
112423 0.0008
123471 0.00077

It's sorted by the second field. So you can plot a nice descending curve in gnuplot with something like

plot "my.dat" using 0:2

What I want to do is generate a second data file with additional information about the first field, like this:

12345 1
12346 3
12347 7
12348 2

and then plot this data against the frequency distribution. Is there any commonly-available Unix utility that will perform the join for me? I will probably end up writing something in Python or Perl that produces the desired result:

23450 0.001 5
172385 0.0009 5
112423 0.0008 15
123471 0.00077 3
Tags: programming, unix
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.