If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > to read middle of a file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-13-04, 18:00
markjason markjason is offline
Registered User
 
Join Date: Jun 2004
Posts: 46
to read middle of a file

How to read lines 500 to 2000 in a 10000 record file and put in a seperate file using sed or awk.


Thanks
mark jason.
Reply With Quote
  #2 (permalink)  
Old 08-14-04, 12:53
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
Code:
 sed -n '500,2000p' input > output
OR
 sed '500,2000!d'  input > output
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #3 (permalink)  
Old 08-16-04, 09:48
markjason markjason is offline
Registered User
 
Join Date: Jun 2004
Posts: 46
Thanks, but my question phrasing was wrong.

i want to search for ceratain words in a file like MILE in first column and assign its 5th column to a variable and if it don't find that word in other lines then i should assign '0' to a variable.

Hope this is clear

Thanks
mark
Reply With Quote
  #4 (permalink)  
Old 08-16-04, 10:43
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Thumbs down

Quote:
Originally Posted by markjason
How to read lines 500 to 2000 in a 10000 record file and put in a seperate file using sed or awk.
Thanks
mark jason.
Quote:
Originally Posted by markjason
Thanks, but my question phrasing was wrong.
i want to search for ceratain words in a file like MILE in first column and assign its 5th column to a variable and if it don't find that word in other lines then i should assign '0' to a variable.
Hope this is clear
Thanks
mark
As clear as muddy waters, here is your answer.
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #5 (permalink)  
Old 08-16-04, 10:51
markjason markjason is offline
Registered User
 
Join Date: Jun 2004
Posts: 46
Thanks

I found what i want from your answer
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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