1. 5
  1.  

  2. 5

    I feel like this article is more of “here’s how to convert vCard to something human-readable for backup purposes”, not “contact management”. To me, contact management implies contact synchronization across platforms, not just centralized import.

    1. 2

      Sorry to disappoint, it does job for me :)

    2. 4

      It appears that you’re the author of the post – make sure to check the “I am the author of the story at this URL (or this text)” checkbox while posting. :)

      1. 2

        Sorry, will try to remember next time.

      2. 3

        I believe it’s possible to ignore whitespace with diff, so that you wouldn’t need to hardcode the width.

        1. 1

          So I wanted to try this out to test, and (like most things on the internet), the results are mixed.

          Suppose you have two files:

          contacts_OLD

          Name Number
          Sue 800-867-5309
          Dave 555-555-5555
          

          contacts_NEW

          Name Number
          Sue 800-867-5309
          Dave 555-555-5555
          MyWhatALongNameYouHave 111-111-1111
          

          If we were to diff -u these two files after a column -t, we would get:

          -Name  Number
          -Sue   800-867-5309
          -Dave  555-555-5555
          +Name                    Number
          +Sue                     800-867-5309
          +Dave                    555-555-5555
          +MyWhatALongNameYouHave  111-111-1111
          

          However, if we switch to using diff -bu, then we successfully get:

           Name  Number
           Sue   800-867-5309
           Dave  555-555-5555
          +MyWhatALongNameYouHave  111-111-1111
          

          However, this is assuming that we don’t have that fancy line of equals at the top. If we dynamically generate that based on column name (an exercise I leave to the reader), even with diff -bu, we still get some false positives:

           Name                    Number
          -======================  ============
          +====  ============
           Sue                     800-867-5309
           Dave                    555-555-5555
          -MyWhatALongNameYouHave  111-111-1111
          

          tl;dr, if you want those fancy equals headers, you gotta hard code them.

          1. 2

            Thank you for that, I forgot about the -b flag :)

            1. 1

              Personally I wouldn’t put the equals line in the file, but if you must, you could instead just strip it out for diffing; e.g.,

              diff -bu \
                  <(awk 'NR > 2' before.txt) \
                  <(awk 'NR > 2' after.txt)