sort File B based on column 3 of File A without changing contents of File A
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have the following file:
cat fileA.txt
seattle 1991 west
atlanta 1993 west
turlock 1998 west
marysville 2004 south
newyork 2007 north
canada 2004 west
And the second file looks like this:
cat fileB.txt
popular
someWhatPopular
boring
popular
popular
popular
I would like to get the following output on fileB.txt
:
popular
popular
popular
someWhatPopular
boring
popular
So essentially I'm trying to sort fileB.txt
to fileA.txt
third column
I tried the following code:
#!/bin/bash
sort -s -k3,3 fileA.txt fileB.txt
But it didn't work. Any suggestions? I'm pretty open to anything that doesn't require hardcoding. Bash/awk/sed, etc.
linux text-processing files sort columns
add a comment |Â
up vote
1
down vote
favorite
I have the following file:
cat fileA.txt
seattle 1991 west
atlanta 1993 west
turlock 1998 west
marysville 2004 south
newyork 2007 north
canada 2004 west
And the second file looks like this:
cat fileB.txt
popular
someWhatPopular
boring
popular
popular
popular
I would like to get the following output on fileB.txt
:
popular
popular
popular
someWhatPopular
boring
popular
So essentially I'm trying to sort fileB.txt
to fileA.txt
third column
I tried the following code:
#!/bin/bash
sort -s -k3,3 fileA.txt fileB.txt
But it didn't work. Any suggestions? I'm pretty open to anything that doesn't require hardcoding. Bash/awk/sed, etc.
linux text-processing files sort columns
What is your algorithm for mapping west:popular, south:someWhatPopular, north:boring?
â glenn jackman
Nov 28 '17 at 1:22
That is part of what I need assitance with, being able to find a way to map it that makes sense. I was thinking of looping through both files and finding contents in column 3 of File A and map them to file B, any examples or thoughts?
â oddRas
Nov 28 '17 at 2:08
One sensible mapping is north:boring, south:popular, west:someWhatPopular since both the keys and the values are lexically sorted within their sets.
â glenn jackman
Nov 28 '17 at 2:20
Right on. Would you have some code snippet that I could build off of? Not too familiar with bash yet
â oddRas
Nov 28 '17 at 2:25
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have the following file:
cat fileA.txt
seattle 1991 west
atlanta 1993 west
turlock 1998 west
marysville 2004 south
newyork 2007 north
canada 2004 west
And the second file looks like this:
cat fileB.txt
popular
someWhatPopular
boring
popular
popular
popular
I would like to get the following output on fileB.txt
:
popular
popular
popular
someWhatPopular
boring
popular
So essentially I'm trying to sort fileB.txt
to fileA.txt
third column
I tried the following code:
#!/bin/bash
sort -s -k3,3 fileA.txt fileB.txt
But it didn't work. Any suggestions? I'm pretty open to anything that doesn't require hardcoding. Bash/awk/sed, etc.
linux text-processing files sort columns
I have the following file:
cat fileA.txt
seattle 1991 west
atlanta 1993 west
turlock 1998 west
marysville 2004 south
newyork 2007 north
canada 2004 west
And the second file looks like this:
cat fileB.txt
popular
someWhatPopular
boring
popular
popular
popular
I would like to get the following output on fileB.txt
:
popular
popular
popular
someWhatPopular
boring
popular
So essentially I'm trying to sort fileB.txt
to fileA.txt
third column
I tried the following code:
#!/bin/bash
sort -s -k3,3 fileA.txt fileB.txt
But it didn't work. Any suggestions? I'm pretty open to anything that doesn't require hardcoding. Bash/awk/sed, etc.
linux text-processing files sort columns
edited Nov 28 '17 at 0:49
Jeff Schaller
32.1k849109
32.1k849109
asked Nov 28 '17 at 0:38
oddRas
82
82
What is your algorithm for mapping west:popular, south:someWhatPopular, north:boring?
â glenn jackman
Nov 28 '17 at 1:22
That is part of what I need assitance with, being able to find a way to map it that makes sense. I was thinking of looping through both files and finding contents in column 3 of File A and map them to file B, any examples or thoughts?
â oddRas
Nov 28 '17 at 2:08
One sensible mapping is north:boring, south:popular, west:someWhatPopular since both the keys and the values are lexically sorted within their sets.
â glenn jackman
Nov 28 '17 at 2:20
Right on. Would you have some code snippet that I could build off of? Not too familiar with bash yet
â oddRas
Nov 28 '17 at 2:25
add a comment |Â
What is your algorithm for mapping west:popular, south:someWhatPopular, north:boring?
â glenn jackman
Nov 28 '17 at 1:22
That is part of what I need assitance with, being able to find a way to map it that makes sense. I was thinking of looping through both files and finding contents in column 3 of File A and map them to file B, any examples or thoughts?
â oddRas
Nov 28 '17 at 2:08
One sensible mapping is north:boring, south:popular, west:someWhatPopular since both the keys and the values are lexically sorted within their sets.
â glenn jackman
Nov 28 '17 at 2:20
Right on. Would you have some code snippet that I could build off of? Not too familiar with bash yet
â oddRas
Nov 28 '17 at 2:25
What is your algorithm for mapping west:popular, south:someWhatPopular, north:boring?
â glenn jackman
Nov 28 '17 at 1:22
What is your algorithm for mapping west:popular, south:someWhatPopular, north:boring?
â glenn jackman
Nov 28 '17 at 1:22
That is part of what I need assitance with, being able to find a way to map it that makes sense. I was thinking of looping through both files and finding contents in column 3 of File A and map them to file B, any examples or thoughts?
â oddRas
Nov 28 '17 at 2:08
That is part of what I need assitance with, being able to find a way to map it that makes sense. I was thinking of looping through both files and finding contents in column 3 of File A and map them to file B, any examples or thoughts?
â oddRas
Nov 28 '17 at 2:08
One sensible mapping is north:boring, south:popular, west:someWhatPopular since both the keys and the values are lexically sorted within their sets.
â glenn jackman
Nov 28 '17 at 2:20
One sensible mapping is north:boring, south:popular, west:someWhatPopular since both the keys and the values are lexically sorted within their sets.
â glenn jackman
Nov 28 '17 at 2:20
Right on. Would you have some code snippet that I could build off of? Not too familiar with bash yet
â oddRas
Nov 28 '17 at 2:25
Right on. Would you have some code snippet that I could build off of? Not too familiar with bash yet
â oddRas
Nov 28 '17 at 2:25
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
1
down vote
accepted
This is a data structure issue more than linux one. You need a common entry ( key) in both tables to link them, the same as in any 'database' and it is good practice to keep a unique key in the first column of any data table. Then you can sort and link to your hearts content.
Taking something like @glennjackman mapping , you define the mapping key as being north, south etc
1 south somewhatPopular
2 west popular
3 north boring
4 east unexplored
in a file called file popularity
. Amend fileA
to include a unique key
1 seattle 1991 west
2 atlanta 1993 west
3 turlock 1998 west
4 marysville 2004 south
5 newyork 2007 north
6 canada 2004 west
then you can manipulate these files by join
ing them on your selected key (in your case column 2 in popularity
maps to column 4 in fileA
) but join
needs both files to be sorted on the keyfield, so
join -1 4 -2 2 <(sort -k4 fileA) <(sort -k2 popularity) | sort -k2 | awk 'print $6'
popular
popular
popular
somewhatPopular
boring
popular
A bit of a sledgehammer approach but it gives you most flexibility.
Break the above command at each pipe and you will see what each step does.
Edit: Explanation of join -1 4 -2 2 # its in the man pages
This tells join
to look at the 4th column in table 1 (-1 4) and find matching values in the 2nd column of table 2 (-2 2).
join
then composes columns from the two tables into single table but only includes the key column (north etc) once. Look at the output from
join -1 4 -2 2 <(sort -k4 fileA) <(sort -k2 popularity)
and it should be clearer
Because we had to sort the data tables for the join
to work, we then
| sort -k2
the combined table to put them back in their original order.
The column you want is column 6 in the combined table so we just
| awk 'print $6'
to stdout.
This is really great! I just need a brief explanation of what you are doing with thejoin -1 4 -2 2
I understand the rest of the code, and then I will mark as correct answer! :)
â oddRas
Nov 28 '17 at 7:16
Nice. The unique key for fileA doesn't contribute anything though
â glenn jackman
Nov 28 '17 at 8:52
Not in this case but if you stick to good practice in keeping a uid in all tables then you will find it invaluable when you graduate to handling bigger and more complex data sets.
â bu5hman
Nov 28 '17 at 10:22
@glennjackman Just realised i was talking rubbish. I explicitly put thefileA
uid in so the results could be sorted back to the original order. It is the uid in thepopularity
file which are redundant in this instance. I must be getting old.
â bu5hman
Nov 28 '17 at 10:46
add a comment |Â
up vote
0
down vote
You might try to paste
the two "table" files together, pipe the output to sort
, then cut
to retain only the fourth column.
Untested (cell phone right now) attempt would be something like
paste fileA fileB | sort -s -k3,3 | cut -f4
add a comment |Â
up vote
0
down vote
You can get the alphabetical mapping with
paste <(awk 'print $NF' fileA.txt | sort -u) <(sort -u fileB.txt)
north boring
south popular
west someWhatPopular
And then a form of your desired output can be produced with awk:
awk '
NR==FNR map[$1] = $2; next
print map[$NF]
' <(paste <(awk 'print $NF' fileA.txt | sort -u) <(sort -u fileB.txt)) fileA.txt
someWhatPopular
someWhatPopular
someWhatPopular
popular
boring
someWhatPopular
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
This is a data structure issue more than linux one. You need a common entry ( key) in both tables to link them, the same as in any 'database' and it is good practice to keep a unique key in the first column of any data table. Then you can sort and link to your hearts content.
Taking something like @glennjackman mapping , you define the mapping key as being north, south etc
1 south somewhatPopular
2 west popular
3 north boring
4 east unexplored
in a file called file popularity
. Amend fileA
to include a unique key
1 seattle 1991 west
2 atlanta 1993 west
3 turlock 1998 west
4 marysville 2004 south
5 newyork 2007 north
6 canada 2004 west
then you can manipulate these files by join
ing them on your selected key (in your case column 2 in popularity
maps to column 4 in fileA
) but join
needs both files to be sorted on the keyfield, so
join -1 4 -2 2 <(sort -k4 fileA) <(sort -k2 popularity) | sort -k2 | awk 'print $6'
popular
popular
popular
somewhatPopular
boring
popular
A bit of a sledgehammer approach but it gives you most flexibility.
Break the above command at each pipe and you will see what each step does.
Edit: Explanation of join -1 4 -2 2 # its in the man pages
This tells join
to look at the 4th column in table 1 (-1 4) and find matching values in the 2nd column of table 2 (-2 2).
join
then composes columns from the two tables into single table but only includes the key column (north etc) once. Look at the output from
join -1 4 -2 2 <(sort -k4 fileA) <(sort -k2 popularity)
and it should be clearer
Because we had to sort the data tables for the join
to work, we then
| sort -k2
the combined table to put them back in their original order.
The column you want is column 6 in the combined table so we just
| awk 'print $6'
to stdout.
This is really great! I just need a brief explanation of what you are doing with thejoin -1 4 -2 2
I understand the rest of the code, and then I will mark as correct answer! :)
â oddRas
Nov 28 '17 at 7:16
Nice. The unique key for fileA doesn't contribute anything though
â glenn jackman
Nov 28 '17 at 8:52
Not in this case but if you stick to good practice in keeping a uid in all tables then you will find it invaluable when you graduate to handling bigger and more complex data sets.
â bu5hman
Nov 28 '17 at 10:22
@glennjackman Just realised i was talking rubbish. I explicitly put thefileA
uid in so the results could be sorted back to the original order. It is the uid in thepopularity
file which are redundant in this instance. I must be getting old.
â bu5hman
Nov 28 '17 at 10:46
add a comment |Â
up vote
1
down vote
accepted
This is a data structure issue more than linux one. You need a common entry ( key) in both tables to link them, the same as in any 'database' and it is good practice to keep a unique key in the first column of any data table. Then you can sort and link to your hearts content.
Taking something like @glennjackman mapping , you define the mapping key as being north, south etc
1 south somewhatPopular
2 west popular
3 north boring
4 east unexplored
in a file called file popularity
. Amend fileA
to include a unique key
1 seattle 1991 west
2 atlanta 1993 west
3 turlock 1998 west
4 marysville 2004 south
5 newyork 2007 north
6 canada 2004 west
then you can manipulate these files by join
ing them on your selected key (in your case column 2 in popularity
maps to column 4 in fileA
) but join
needs both files to be sorted on the keyfield, so
join -1 4 -2 2 <(sort -k4 fileA) <(sort -k2 popularity) | sort -k2 | awk 'print $6'
popular
popular
popular
somewhatPopular
boring
popular
A bit of a sledgehammer approach but it gives you most flexibility.
Break the above command at each pipe and you will see what each step does.
Edit: Explanation of join -1 4 -2 2 # its in the man pages
This tells join
to look at the 4th column in table 1 (-1 4) and find matching values in the 2nd column of table 2 (-2 2).
join
then composes columns from the two tables into single table but only includes the key column (north etc) once. Look at the output from
join -1 4 -2 2 <(sort -k4 fileA) <(sort -k2 popularity)
and it should be clearer
Because we had to sort the data tables for the join
to work, we then
| sort -k2
the combined table to put them back in their original order.
The column you want is column 6 in the combined table so we just
| awk 'print $6'
to stdout.
This is really great! I just need a brief explanation of what you are doing with thejoin -1 4 -2 2
I understand the rest of the code, and then I will mark as correct answer! :)
â oddRas
Nov 28 '17 at 7:16
Nice. The unique key for fileA doesn't contribute anything though
â glenn jackman
Nov 28 '17 at 8:52
Not in this case but if you stick to good practice in keeping a uid in all tables then you will find it invaluable when you graduate to handling bigger and more complex data sets.
â bu5hman
Nov 28 '17 at 10:22
@glennjackman Just realised i was talking rubbish. I explicitly put thefileA
uid in so the results could be sorted back to the original order. It is the uid in thepopularity
file which are redundant in this instance. I must be getting old.
â bu5hman
Nov 28 '17 at 10:46
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
This is a data structure issue more than linux one. You need a common entry ( key) in both tables to link them, the same as in any 'database' and it is good practice to keep a unique key in the first column of any data table. Then you can sort and link to your hearts content.
Taking something like @glennjackman mapping , you define the mapping key as being north, south etc
1 south somewhatPopular
2 west popular
3 north boring
4 east unexplored
in a file called file popularity
. Amend fileA
to include a unique key
1 seattle 1991 west
2 atlanta 1993 west
3 turlock 1998 west
4 marysville 2004 south
5 newyork 2007 north
6 canada 2004 west
then you can manipulate these files by join
ing them on your selected key (in your case column 2 in popularity
maps to column 4 in fileA
) but join
needs both files to be sorted on the keyfield, so
join -1 4 -2 2 <(sort -k4 fileA) <(sort -k2 popularity) | sort -k2 | awk 'print $6'
popular
popular
popular
somewhatPopular
boring
popular
A bit of a sledgehammer approach but it gives you most flexibility.
Break the above command at each pipe and you will see what each step does.
Edit: Explanation of join -1 4 -2 2 # its in the man pages
This tells join
to look at the 4th column in table 1 (-1 4) and find matching values in the 2nd column of table 2 (-2 2).
join
then composes columns from the two tables into single table but only includes the key column (north etc) once. Look at the output from
join -1 4 -2 2 <(sort -k4 fileA) <(sort -k2 popularity)
and it should be clearer
Because we had to sort the data tables for the join
to work, we then
| sort -k2
the combined table to put them back in their original order.
The column you want is column 6 in the combined table so we just
| awk 'print $6'
to stdout.
This is a data structure issue more than linux one. You need a common entry ( key) in both tables to link them, the same as in any 'database' and it is good practice to keep a unique key in the first column of any data table. Then you can sort and link to your hearts content.
Taking something like @glennjackman mapping , you define the mapping key as being north, south etc
1 south somewhatPopular
2 west popular
3 north boring
4 east unexplored
in a file called file popularity
. Amend fileA
to include a unique key
1 seattle 1991 west
2 atlanta 1993 west
3 turlock 1998 west
4 marysville 2004 south
5 newyork 2007 north
6 canada 2004 west
then you can manipulate these files by join
ing them on your selected key (in your case column 2 in popularity
maps to column 4 in fileA
) but join
needs both files to be sorted on the keyfield, so
join -1 4 -2 2 <(sort -k4 fileA) <(sort -k2 popularity) | sort -k2 | awk 'print $6'
popular
popular
popular
somewhatPopular
boring
popular
A bit of a sledgehammer approach but it gives you most flexibility.
Break the above command at each pipe and you will see what each step does.
Edit: Explanation of join -1 4 -2 2 # its in the man pages
This tells join
to look at the 4th column in table 1 (-1 4) and find matching values in the 2nd column of table 2 (-2 2).
join
then composes columns from the two tables into single table but only includes the key column (north etc) once. Look at the output from
join -1 4 -2 2 <(sort -k4 fileA) <(sort -k2 popularity)
and it should be clearer
Because we had to sort the data tables for the join
to work, we then
| sort -k2
the combined table to put them back in their original order.
The column you want is column 6 in the combined table so we just
| awk 'print $6'
to stdout.
edited Nov 29 '17 at 12:29
answered Nov 28 '17 at 5:45
bu5hman
1,164214
1,164214
This is really great! I just need a brief explanation of what you are doing with thejoin -1 4 -2 2
I understand the rest of the code, and then I will mark as correct answer! :)
â oddRas
Nov 28 '17 at 7:16
Nice. The unique key for fileA doesn't contribute anything though
â glenn jackman
Nov 28 '17 at 8:52
Not in this case but if you stick to good practice in keeping a uid in all tables then you will find it invaluable when you graduate to handling bigger and more complex data sets.
â bu5hman
Nov 28 '17 at 10:22
@glennjackman Just realised i was talking rubbish. I explicitly put thefileA
uid in so the results could be sorted back to the original order. It is the uid in thepopularity
file which are redundant in this instance. I must be getting old.
â bu5hman
Nov 28 '17 at 10:46
add a comment |Â
This is really great! I just need a brief explanation of what you are doing with thejoin -1 4 -2 2
I understand the rest of the code, and then I will mark as correct answer! :)
â oddRas
Nov 28 '17 at 7:16
Nice. The unique key for fileA doesn't contribute anything though
â glenn jackman
Nov 28 '17 at 8:52
Not in this case but if you stick to good practice in keeping a uid in all tables then you will find it invaluable when you graduate to handling bigger and more complex data sets.
â bu5hman
Nov 28 '17 at 10:22
@glennjackman Just realised i was talking rubbish. I explicitly put thefileA
uid in so the results could be sorted back to the original order. It is the uid in thepopularity
file which are redundant in this instance. I must be getting old.
â bu5hman
Nov 28 '17 at 10:46
This is really great! I just need a brief explanation of what you are doing with the
join -1 4 -2 2
I understand the rest of the code, and then I will mark as correct answer! :)â oddRas
Nov 28 '17 at 7:16
This is really great! I just need a brief explanation of what you are doing with the
join -1 4 -2 2
I understand the rest of the code, and then I will mark as correct answer! :)â oddRas
Nov 28 '17 at 7:16
Nice. The unique key for fileA doesn't contribute anything though
â glenn jackman
Nov 28 '17 at 8:52
Nice. The unique key for fileA doesn't contribute anything though
â glenn jackman
Nov 28 '17 at 8:52
Not in this case but if you stick to good practice in keeping a uid in all tables then you will find it invaluable when you graduate to handling bigger and more complex data sets.
â bu5hman
Nov 28 '17 at 10:22
Not in this case but if you stick to good practice in keeping a uid in all tables then you will find it invaluable when you graduate to handling bigger and more complex data sets.
â bu5hman
Nov 28 '17 at 10:22
@glennjackman Just realised i was talking rubbish. I explicitly put the
fileA
uid in so the results could be sorted back to the original order. It is the uid in the popularity
file which are redundant in this instance. I must be getting old.â bu5hman
Nov 28 '17 at 10:46
@glennjackman Just realised i was talking rubbish. I explicitly put the
fileA
uid in so the results could be sorted back to the original order. It is the uid in the popularity
file which are redundant in this instance. I must be getting old.â bu5hman
Nov 28 '17 at 10:46
add a comment |Â
up vote
0
down vote
You might try to paste
the two "table" files together, pipe the output to sort
, then cut
to retain only the fourth column.
Untested (cell phone right now) attempt would be something like
paste fileA fileB | sort -s -k3,3 | cut -f4
add a comment |Â
up vote
0
down vote
You might try to paste
the two "table" files together, pipe the output to sort
, then cut
to retain only the fourth column.
Untested (cell phone right now) attempt would be something like
paste fileA fileB | sort -s -k3,3 | cut -f4
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You might try to paste
the two "table" files together, pipe the output to sort
, then cut
to retain only the fourth column.
Untested (cell phone right now) attempt would be something like
paste fileA fileB | sort -s -k3,3 | cut -f4
You might try to paste
the two "table" files together, pipe the output to sort
, then cut
to retain only the fourth column.
Untested (cell phone right now) attempt would be something like
paste fileA fileB | sort -s -k3,3 | cut -f4
answered Nov 28 '17 at 4:43
BRPocock
35118
35118
add a comment |Â
add a comment |Â
up vote
0
down vote
You can get the alphabetical mapping with
paste <(awk 'print $NF' fileA.txt | sort -u) <(sort -u fileB.txt)
north boring
south popular
west someWhatPopular
And then a form of your desired output can be produced with awk:
awk '
NR==FNR map[$1] = $2; next
print map[$NF]
' <(paste <(awk 'print $NF' fileA.txt | sort -u) <(sort -u fileB.txt)) fileA.txt
someWhatPopular
someWhatPopular
someWhatPopular
popular
boring
someWhatPopular
add a comment |Â
up vote
0
down vote
You can get the alphabetical mapping with
paste <(awk 'print $NF' fileA.txt | sort -u) <(sort -u fileB.txt)
north boring
south popular
west someWhatPopular
And then a form of your desired output can be produced with awk:
awk '
NR==FNR map[$1] = $2; next
print map[$NF]
' <(paste <(awk 'print $NF' fileA.txt | sort -u) <(sort -u fileB.txt)) fileA.txt
someWhatPopular
someWhatPopular
someWhatPopular
popular
boring
someWhatPopular
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You can get the alphabetical mapping with
paste <(awk 'print $NF' fileA.txt | sort -u) <(sort -u fileB.txt)
north boring
south popular
west someWhatPopular
And then a form of your desired output can be produced with awk:
awk '
NR==FNR map[$1] = $2; next
print map[$NF]
' <(paste <(awk 'print $NF' fileA.txt | sort -u) <(sort -u fileB.txt)) fileA.txt
someWhatPopular
someWhatPopular
someWhatPopular
popular
boring
someWhatPopular
You can get the alphabetical mapping with
paste <(awk 'print $NF' fileA.txt | sort -u) <(sort -u fileB.txt)
north boring
south popular
west someWhatPopular
And then a form of your desired output can be produced with awk:
awk '
NR==FNR map[$1] = $2; next
print map[$NF]
' <(paste <(awk 'print $NF' fileA.txt | sort -u) <(sort -u fileB.txt)) fileA.txt
someWhatPopular
someWhatPopular
someWhatPopular
popular
boring
someWhatPopular
answered Nov 28 '17 at 13:32
glenn jackman
46.8k265103
46.8k265103
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407388%2fsort-file-b-based-on-column-3-of-file-a-without-changing-contents-of-file-a%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What is your algorithm for mapping west:popular, south:someWhatPopular, north:boring?
â glenn jackman
Nov 28 '17 at 1:22
That is part of what I need assitance with, being able to find a way to map it that makes sense. I was thinking of looping through both files and finding contents in column 3 of File A and map them to file B, any examples or thoughts?
â oddRas
Nov 28 '17 at 2:08
One sensible mapping is north:boring, south:popular, west:someWhatPopular since both the keys and the values are lexically sorted within their sets.
â glenn jackman
Nov 28 '17 at 2:20
Right on. Would you have some code snippet that I could build off of? Not too familiar with bash yet
â oddRas
Nov 28 '17 at 2:25