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
  Search this Thread
Old 03-09-2005, 10:44 AM   #1
spud
LQ Newbie
 
Registered: Oct 2004
Posts: 19

Rep: Reputation: 0
Still a newbie


Hi
If you trace the forums back you can probably see where im going......

Anyway
Im very very new to this so bear with me...
Im trying to edit a text file extracting only certain information from it...
ie..

FILE -- arp.table

? (10.10.10.10) at 00:00:00:AA:AA:AA [ether] on eth0
? (10.10.10.11) at 00:00:00:BB:BB:BB [ether] on eth0

RESULT WANTED

10.10.10.10 00:00:00:AA:AA:AA
10.10.10.11 00:00:00:BB:BB:BB
and so on

can anyone help
Many thanks
And for people like me this forum is a god send
 
Old 03-09-2005, 10:53 AM   #2
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
What method are you using to exit the text file? If you only need to parse the data and retrieve the result you wish, perl is a good choice. A regex can do that for you.. bash can do it, too (possibly using awk/sed -- I don't know these very well) but not as easily as perl. I guess the question is, what language are you wanting to use?
 
Old 03-09-2005, 10:59 AM   #3
spud
LQ Newbie
 
Registered: Oct 2004
Posts: 19

Original Poster
Rep: Reputation: 0
Basically im open to offers as im only just starting in this field. You said that Perl would be the easier choice so

How could i get perl to output only the results wanted as above.
 
Old 03-09-2005, 11:05 AM   #4
zeropash
Member
 
Registered: Apr 2003
Location: Bangalore,India
Distribution: FC2, RHES, RH9, FC3, FC1, Slackware 3.0
Posts: 208

Rep: Reputation: 30
is this sufficient?
cut -d' ' -f2,4 arp.table | tr -d '()'


Last edited by zeropash; 03-09-2005 at 11:08 AM.
 
Old 03-09-2005, 11:22 AM   #5
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
Nice zeropash. I tend to think 'perl' first in many situations, and usually there are ways to do it already. That's nice. (=
 
Old 03-09-2005, 11:37 AM   #6
zeropash
Member
 
Registered: Apr 2003
Location: Bangalore,India
Distribution: FC2, RHES, RH9, FC3, FC1, Slackware 3.0
Posts: 208

Rep: Reputation: 30
I am a lazy guy
 
Old 03-09-2005, 12:16 PM   #7
spud
LQ Newbie
 
Registered: Oct 2004
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks a lot, thats worked great.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
security newbie, but not Linux newbie. advice on secure delete tools mattie_linux Linux - Security 19 08-15-2005 01:50 AM
Linux semi-newbie and Wine vary newbie geovolt_os1 Linux - Software 4 04-19-2005 11:03 AM
newbie;I am a linux newbie who has installed slackware and have run into a few proble MollyJolly Slackware - Installation 6 06-01-2004 11:21 AM
How To Update To Slackware-Current For a Newbie, By a Newbie :) windsok Slackware 1 09-18-2003 08:53 PM
ipchains newbie. Kernel newbie skeletal29 Linux - Security 3 06-02-2002 03:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:18 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration