[SOLVED] What is the easiest way to convert this hash format to another format?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What is the easiest way to convert this hash format to another format?
Could you help me what the easiest way is to convert these hashes on terminal with commands?
From this format:
oAZkAse75vY3DUyTwXhW*K$wqoWNvN,ae6a26879f684db2737173fecf6b9199ac5ed5ec0d1b66ac9474ec5fb794fc55
3ZIdz2V538b@L36c@Ces%MWKvkyXri,27aa7b56ecf8f93f72961bddc4a121ce4f251dc3a3ece660f351a88d777ec43d
to his format:
ae6a26879f684db2737173fecf6b9199ac5ed5ec0d1b66ac9474ec5fb794fc55AZkAse75vY3DUyTwXhW*K$wqoWNvN
27aa7b56ecf8f93f72961bddc4a121ce4f251dc3a3ece660f351a88d777ec43d:3ZIdz2V538b@L36c@Ces%MWKvkyXri
You're welcome. The important thing is that "awk" becomes more familiar. It will over time. What did you think of the "awk" manual page regarding FS and OFS? And about $1 and $2 and how they relate to FS and OFS?
Thanks. I like awk. FS= file separator of input data, OFS= file separator of output data, changing FS to OFS. Is it correct?
I got another tip:
sed -n "s/\(.*\),\([a-f0-9]*\)/\2:\1/p" input.txt >> output.txt
What is the difference between awk and sed?
I know tr, uniq, sort, cat, tac and other easy commands. awk and sed more complex....But until this time I didn't need these commands. So which is the most familar? Which is easier to learn?
They each lend themselves to somewhat different tasks. It's useful to find what you find each is good for and then use them for that. There is often an optimal zone where a task will lend itself more to one than another. So it's more of the idea of the right tool for the job. As to what is more familiar, that depends on which one you use most. For me it is "perl". You should find all three on any system you encounter. They're all pretty easy to get the hang of, again the one you use most will become most familiar and thus easiest.
One thing to remember is maintainability and much of that depends on code that clear to understand. You can do weird or overly clever things in "sed" that might be easier for another person to follow if you use "awk". Same for "perl" over "awk". But anyone can write clear or unclear code in most any language, since a good portion of that choice is up to the coder. Make the computer do the work. That's what it's for.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.