How can I create a table from key-value pairs?

mt025

I want to check the differences between lots of key value pairs. I know I could write some code to do this, but I feel there is going to be an easier way to accomplish this. These values come from HTTP request URLs.

Say I have the following key value pairs, they are not always in order:

Set 1:

a=1
b=2
c=3

Set 2:

a=2
c=5
b=7

Set 3:

b=5
c=2
a=8

Set 4:

a=1
c=6
b=7

I'm looking for an output like this, just so I can easily see differences:

The output I'm looking for

How can I achieve this easily, without having to write my own program?

Devin R

You could use awk for this:

cat file1 file2 | awk -F "=" '{i[$1]=(i[$1] " " $2)} END {for (key in i) { print key " " i[key]}}'

Example output:

d  104 42
a  8 9
b  9 13
c  22 -1

Additionally pipe to sort if you want the values in a consistent order.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I use gson to create a set of key value pairs?

how can I create nested dictionary keys and assign them values from a list of namespaced key value pairs?

How can I extract these key/value pairs from this JSON node?

How can I create key-value pairs object where value is component?

How can I create a new object that only contains the key/value pairs specified in an array?

How can I query a table with key/value pairs into a JSON object using FOR JSON PATH?

How can i display key value pairs in a table grid in react js.?

How do I find a shared key value from a MySQL table of matched pairs?

How do I use key value pairs from a dictionary to feed table view cells their title?

How can I create a dictionary of dictionaries of Unique Key Pairs?

How can I add only particular key value pairs from one object to another?

How can I populate the key value pairs of a new dictionary from an existing dictionary?

How to create an object from an Array of key-value pairs?

How to create a dictionary that contains key‐value pairs from a text file

How can I add values in key value pairs generated in scala

How can I merge two dictionaries with multiple key value pairs

How can I access random key value pairs with JS?

How to Create a list of key/value pairs in JavaScript

How to create Array with Key Value Pairs in PHP

How to create a Dictionary with Key/Value pairs in angular?

How to load key value pairs into hive table?

How can I use complex binding to get keys displayed rather then values from key value pairs in view.xml

Can I create an unordered_map of string and atomic<int> key-value pairs?

Can I get some strategy to unstack column into key value pairs, with a view to make a logical table

How can I create a view that does a joins a table to itself and gives a means to select based on a key value

How can I enumerate a hashtable as key-value pairs / filter a hashtable by a collection of key values

How can I INSERT multiple rows by adding same value to ID's from other table thus creating new pairs?

How can I find the key-value pairs that have smallest value in Spark-streaming?

How do I create an index in Fauna DB that returns sorted data in key value pairs

TOP Ranking

HotTag

Archive