1

I got two files one called lte and the other called fcc2. The attached image is the fcc2 file. The first file is just a list of census blocks. 15 digit number per line on the lte file.I need help changing just the lines in the fcc2 file that have the same 15 digit number at the start of the line. Just need to change 2 variables in the line. FCC2 is a TSV file. any help would be appreciated.

Comments
  • 0
    Here is the lte file I need to match these in the fcc2 file and change the 15 and 2 to be 50 and 5. but only for the lines that match the lte file.
  • 1
    Well, you got bash.
    Read the lte file. Save it to a variable.
    For every sed match, change that line with the variables you want.

    Or if you feel fanceh, write a python script.
    You already know how to parse the thing, tabs and newlines.
  • 0
    @melezorus34 My biggest problem is the output includes some from the fcc2 file that don't match numbers in the lte file.
  • 0
    @icycrash ask who gave the task for details. Maybe you just need to create new lines with missing ids
  • 0
    @melezorus34 The only ones that need modified are all in the lte file. i'm just trying to figure out the best way to automate this because the only other option is by hand. There is 4800 id's in the lte file so by hand would take awhile.
  • 1
    @icycrash
    Read lte
    Get ids from lte to a array
    Read fcc, iterate each line
    change line if id is in array. Note the id into another array if it matches.
    Output all ids that are not found (aka not in changed array) into another file.

    Profit
  • 1
    I figured it out. The census blocks they gave me in the lte file are out of date and don't line up with the new ones in the fcc2 file. Long story short they screwed me with outdated info. @zlice @melezorus34
Add Comment