- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Script help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 08:34 AM
тАО08-12-2005 08:34 AM
I want a script which will get for a pattern, and depending on Line number pattern, will display 4Lines above the line and 4Line Below that line. I am finding it challening!
Thanks in advance
Prashant
Solved! Go to Solution.
- Tags:
- grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 08:42 AM
тАО08-12-2005 08:42 AM
Re: Script help
Prashant,
Could you send an example of input and what you would like to see on output? How big is the input data file (under 2GB?) I'm thinking awk can do this using arrays. But I'd like an example so that it is clear what we are trying to do. Thanks!
-- Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 08:48 AM
тАО08-12-2005 08:48 AM
Re: Script help
Thanks and regards
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 08:58 AM
тАО08-12-2005 08:58 AM
Re: Script help
cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 09:00 AM
тАО08-12-2005 09:00 AM
Re: Script help
Fri Aug 12 05:34:56 2005
drop rollback segment RB32
Completed: drop rollback segment RB32
Fri Aug 12 05:36:08 2005
drop tablespace RBS
Fri Aug 12 05:36:36 2005
Errors in file /oracle/admin/COREPROD/bdump/coreprod_j002_7027.trc:
ORA-12012: error on auto execute of job 137728
ORA-01405: fetched column value is NULL
ORA-06512: at "SYS.DBMS_AQADM_SYS", line 5636
ORA-06512: at "SYS.DBMS_AQADM_SYS", line 6061
ORA-06512: at "SYS.DBMS_AQADM", line 895
ORA-06512: at line 1
Fri Aug 12 05:36:36 2005
Errors in file /oracle/admin/COREPROD/bdump/coreprod_j001_7025.trc:
Here are errors pasted.
While these errors can be many in file, if provision can be made to see from recent dates of 2-3 days will be great.
Thanks
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 09:02 AM
тАО08-12-2005 09:02 AM
SolutionPATTERN="string_here"
for lineno in `grep -n $PATTERN $FILE|cut -d: -f1`
do
(( TOP=$lineno-5 ))
(( BOT=$lineno+5 ))
cat $FILE | sed -e "${BOT},\$d" | sed -e "1,${TOP}d"
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" # block separator
done
this should do the trick.. even for multiple instances of the same string repeating in the source file.
HTH
UNIX because I majored in cryptology...
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 09:07 AM
тАО08-12-2005 09:07 AM
Re: Script help
=============================================
# cat - <
> wq
> EOF
=============================================
cheers!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 09:34 AM
тАО08-12-2005 09:34 AM
Re: Script help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2005 11:40 AM
тАО08-12-2005 11:40 AM
Re: Script help
While I dont find 2nd solution from Sandman not working, basically whole file is scrolling..AM I doing anything wrong.
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-13-2005 04:39 AM
тАО08-13-2005 04:39 AM
Re: Script help
I tested this code on your trace file and it worked fine. But, I'm not sure why its not working on yours.
Try this one and replace string ORA-6512 with actual pattern you are searching for:
# ex -s
> EOF
- Tags:
- ex