User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 391,573 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,817 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser:
Views: 382 | Replies: 3
Reply
Join Date: Jul 2008
Posts: 2
Reputation: jack00423 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jack00423 jack00423 is offline Offline
Newbie Poster

Need to print certain lines from a file

  #1  
34 Days Ago
Hi ALL,

I want to print some lines from file like
example
=====
RECOVER DATABASE
ALTER DATABASE OPEN;
ALTER TABLESPACE TEMP ADD
ALTER TABLESPACE TEMP ADD STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 16
MAXLOGMEMBERS 5
MAXDATAFILES 512
MAXINSTANCES 1
MAXLOGHISTORY 7260
LOGFILE


I want to print the lines from "ALTER TABLESPACE TEMP ADD " to till "MAXINSTANCES 1"

Pleas help me in this
Thanks
Jack
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2005
Posts: 3,257
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 20
Solved Threads: 368
Colleague
Salem's Avatar
Salem Salem is offline Offline
void main'ers are DOOMed

Re: Need to print certain lines from a file

  #2  
34 Days Ago
awk '/ALTER TABLESPACE TEMP ADD/,/MAXINSTANCES 1/' file.txt
Or something like it.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Reply With Quote  
Join Date: Jul 2008
Posts: 2
Reputation: jack00423 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jack00423 jack00423 is offline Offline
Newbie Poster

Re: Need to print certain lines from a file

  #3  
34 Days Ago
It worked for me..Thanks a lot reply...
Reply With Quote  
Join Date: Aug 2008
Posts: 3
Reputation: pritishs is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
pritishs pritishs is offline Offline
Newbie Poster

Re: Need to print certain lines from a file

  #4  
5 Days Ago
cat -n filename|tail +3 |head -8

cat  -n filename|head -10|tail -8

cat -n filename|sed '3,10p'

cat -n filename|grep -B +7 "10"
Last edited by Tekmaven : 5 Days Ago at 1:45 pm. Reason: Code tags
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Shell Scripting Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 10:29 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC