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 http://screencast.com/t/X3FUrEYVfQpm
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?
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.

jmcgOwnerCommented:
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.
1
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
https://www.dropbox.com/s/owsc0yl59u6mnze/RegExr.png?dl=0

Thanks very much
0
jmcgOwnerCommented:
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.
1
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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
0
jmcgOwnerCommented:
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

0

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.
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.