LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-08-2008, 11:41 PM   #1
jkeertir
Member
 
Registered: Mar 2008
Posts: 70

Rep: Reputation: 15
seperating substring


Dear ALL,

I have data in the file as follows


222.142.111.45.aaa.bbb.ddd.net
121.22.112.33.hh.ll.net.
444.23.34.46.ll.ki.net

I want only first and last line of the file
and as
.aaa.bbb.ddd.net
.ll.ki.net


Please can any one help me to solve the issue.

With Regards,
Keerti
 
Old 04-09-2008, 12:37 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Code:
sed -n '1s/^[[:digit:]\.]*/./p;$s/^[[:digit:]]\.*/./p' testfile
 
  


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
php preg_replace substring of a substring senyahnoj Programming 5 12-08-2006 11:31 AM
to get a substring dimah Programming 1 06-22-2006 06:31 AM
Lua - seperating a string blackman890 Programming 13 03-28-2005 10:04 AM
Seperating IPTABLES Logs TheRealDeal Linux - Security 5 02-26-2005 08:51 AM
seperating values using perl pantera Programming 3 05-26-2004 12:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:36 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration