data cleanup using sed

Hello, i am new to *NIX and for my security pen-testing class i have to cleanup a db dump. the instruction are to retrieve only the user name and Hash. please see
I removed partial information from the original dump and now i am left with only a DB with user information.

Let me know if any additional info is needed
Thank you for your assistance
Felix BakhmanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The data shown on that screendump does not at first appear to be a good candidate for using with sed. What do you look for as a human to spot the username and hash? What can you tell about the structure of the data that would let you construct instructions for sed to pull out that data. Think in terms of record separators, field separators, and relative field positions -- or possibly regular expressions.
Felix BakhmanAuthor Commented:
Hello jmcg, i have attempted to use RegExr .com to some what attempt to clean up the data. I was able to highlight the user name and hash and an extra field that i have no use for, the challenge for me is applying this to the terminal
Please see screen shot

Thanks very much
Hash is just a string of (lowercase) hex? It looks like you have the right subexpression to match that.

Are usernames not allowed to have numbers?

It looks like there are grouping parens in the input data and the username appears as the second field and the hash appears as the third field. If these are the only paren groups in the data, you could use awk to consider the record separator to be the open paren and the field separator to be the three-character sequence ',' and pull out fields 2 and 3.
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Felix BakhmanAuthor Commented:
Yes each users information are separated by (    ) in the data, Usernames can be any character.
My goal is to be able to retrieve the username and the hash in the following order and format

Username : Hash

Thank you
Maybe something like the following? Using awk seems easier than using sed.

 awk 'BEGIN{RS="(";FS=".,."}{print $2,":",$3}' /tmp/testdata1.txt

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Felix BakhmanAuthor Commented:
Thank you so very much for your expertise.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.