Skip to content

A Python parsing engine for logging the configuration differences between two input files based on a line schema.

Notifications You must be signed in to change notification settings

dariusstrasel/field_tag_comparator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Field List Comparator

Problem:

  1. Take two files and compare the lines that exist in the files. The two files provided are: old_file.txt and new_file.txt.

The files have lines that look like this: TAG : field-list

Solution:

You should create an Python program that compares each tag and for tags that match, compares each space-separated field. The output should be a list of the tags that are in both files and a comparison of the fields that are common, only in the old or only in the new.

Suppress tags where there is an exact match.

For example, given the two lines:

   C_LINK_CMD: lnk2000 -q -c -w -x --heap=0x800 --stack=0x400 -m link.map
   
   C_LINK_CMD: cl2000 -g -z -w -x --heap=0x800 --stack=0x400 -m link.map

Your output should look like this:

Tag Name: C_LINK_CMD
   
Existing Values:  lnk2000 -q -c -w -x --heap=0x800 --stack=0x400 -m link.map
   
New Values:  cl2000 -g -z -w -x --heap=0x800 --stack=0x400 -m link.map
   
Fields Ommitted: lnk2000 -q -c 
   
Fields Added: cl2000 -g -z 

Please sort the output by tag name

How to run:

  1. Clone repo
  2. Ensure Python 3+ is installed
  3. run main.py as follows:
  • MacOS / Linux
python3 main.py inputs/Old_File.txt inputs/Old_File.txt
  • Windows
python main.py inputs/Old_File.txt inputs/Old_File.txt

3a. You may also pass in different input files by modifying the first and second CLI arguments to refer to a different file.

About

A Python parsing engine for logging the configuration differences between two input files based on a line schema.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages