LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
LinkBack Search this Thread
Old 12-14-2008, 06:42 PM   #1
tt1ect
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

thanks
 
Old 12-14-2008, 06:51 PM   #2
penguiniator
Member
 
Registered: Feb 2004
Location: Milton, WA
Distribution: Fedora
Posts: 440
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:
tt1ect
ikesma

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


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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


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

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