Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-14-2008, 07:42 PM   #1
LQ Newbie
Registered: Oct 2008
Posts: 5

Rep: Reputation: 0
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

Old 12-14-2008, 07:51 PM   #2
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SSL keeps breaking... Need help! jim.thornton Linux - Server 0 01-26-2008 09:57 AM
Breaking out of Chroot Aeiri Linux - Security 1 02-26-2005 03:10 PM
Breaking Into Programming - What now? simsjr Programming 14 06-07-2004 02:16 PM
breaking waves... marsques Linux - Software 4 05-18-2004 02:25 AM
Breaking Windows cli_man General 17 04-20-2002 03:35 AM

All times are GMT -5. The time now is 04:50 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration