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.
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!
Hello,
It would really depend on the data, but what you could do is try and use the following Bash script:
#!/bin/bash
# A file containing the city list with the wrong names:
wrong_names=wrong.txt
# A file containing the city list with the right names:
right_names=right.txt
# 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!
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.