-   Programming (
-   -   Breaking fields (

tt1ect 12-14-2008 06:42 PM

Breaking fields
Hello guys,

I am trying to read a file that conatins the information below, but as you can see the line are joined (one word) but i ma trying to break it and extract the username and password, what command can i use to do this

name of the file is test.txt

current_form=loginForm&next=%2Findex&[I][I][I][I][I][I][I][I]username=tt1ect&password=ikesma&action_login=Log+In&session_token=6YSXBc7nvWh8vSlmLarlQ0YXh2h8MTIyOD gzMTQwOQ%3D%3D


penguiniator 12-14-2008 06:51 PM

echo 'current_form=loginForm&next=%2Findex&[i][i][i][i][i][i][i][i]username=tt1ect&password=ikesma&action_login=Log+In&session_token=6YSXBc7nvWh8vSlmLarlQ0YXh2h8MTIyOD gzMTQwOQ%3D%3D' | tr '&' '\n' | awk -F'=' '/username|password/ {print $2}'

This produces:

You can separate them with separate regex's in awk if you need to.

All times are GMT -5. The time now is 11:10 AM.