How to Arrange string data if both data have different spellings

I’ve been given a task to sort 1400 city names which has wrong spellings. with another data which has the right spellings. I want the result to be shown as the right and wrong data alligned together next to each other.

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
February 18, 2022


It would really depend on the data, but what you could do is try and use the following Bash script:


# A file containing the city list with the wrong names:

# A file containing the city list with the right names:

# Sort the files:
wrong_names_sorted=$(cat ${wrong_names} | sort > wrong_names_sorted.txt)
right_names_sorted=$(cat ${right_names} | sort > right_names_sorted.txt)

# Compare the two sorted files side by side:

sdiff ${wrong_names_sorted} ${right_names_sorted}

Hope that this helps!