Register
It is currently Tue Sep 02, 2014 8:08 pm

How do i select all contents between two Numbers.


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Mon Mar 05, 2012 12:39 am   

Joined: Mon Mar 05, 2012 12:19 am
Posts: 1
I want to select contents between two numbers say 1. and 2. from an output file which has many numbers but only the these two ending with a dot(.) eg 1. 2 . 32. etc I was looking to select with the use of a counter then modify the selected contents and put it in an output file where again the output file seems to overwrite. The external file contains many spaces and new lines in the contents. I am newbie in scripting. Sorry for the long post.


Top
 Profile  
 PostPosted: Fri Mar 09, 2012 12:06 pm   
Moderator
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 242
Hi ausfragen!

Could you give us a better example of the data you're working with? Is the formatting consistent? In your example you have spaces between the dots and numbers in some places, but not in others. Is that how it looks in the file?


Top
 Profile YIM  
 PostPosted: Fri Mar 30, 2012 12:25 pm   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
Code:
sed -n '/1\./,/2\./{s///;p;}' file


Is this what you want?


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP