The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
GREP problem kdyzsa Shell Programming and Scripting 2 05-13-2008 01:57 AM
Grep problem felixwhoals UNIX for Dummies Questions & Answers 1 12-17-2007 08:00 AM
Problem with GREP. syndex Shell Programming and Scripting 2 07-11-2007 01:44 PM
grep problem. help!!! imppayel Shell Programming and Scripting 1 11-30-2004 05:49 AM
Grep problem odogbolu98 Shell Programming and Scripting 3 02-18-2003 03:53 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-21-2008
infyanurag infyanurag is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 64
grep problem

SQL*Plus: Release 9.2.0.8.0 - Production on Mon Jul 21 07:53:35 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning option
JServer Release 9.2.0.8.0 - Production

SQL> SQL> USER is "CCOD"
SQL> cREATE TABLE HELLOEVERY (DEF VARCHAR2(40))
*
ERROR at line 1:
ORA-00955: name is already used by an existing object


SQL> Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning option
JServer Release 9.2.0.8.0 - Production
SQL*Plus: Release 9.2.0.8.0 - Production on Mon Jul 21 07:53:35 2008

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning option
JServer Release 9.2.0.8.0 - Production

SQL> SQL> USER is "CCOD"
SQL> cREATE TABLE greatwork(abcVARCHAR2(40))
*
ERROR at line 1:
ORA-00955: name is already used by an existing object


SQL> Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning option
JServer Release 9.2.0.8.0 - Production


i just want to have
SQL> cREATE TABLE HELLOEVERY (DEF VARCHAR2(40))
*
ERROR at line 1:
ORA-00955: name is already used by an existing object

SQL> cREATE TABLE greatwork(abcVARCHAR2(40))
*
ERROR at line 1:
ORA-00955: name is already used by an existing object


there could be repeated pattern as well.

is there any way to grep only 3 or 4 lines after grepping a pattern

please help

thanks
  #2 (permalink)  
Old 07-21-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,257
Not grep, but an example with sed:
Code:
root@isau02:/data/tmp/testfeld> cat infile
ID .... VALUE
A001 .... 100
B002 .... 200
A004 .... 300
B006 .... 100
A997 .... 200
B776 .... 400
root@isau02:/data/tmp/testfeld> sed -n '/B002/ {p;n;p;n;p}' infile
B002 .... 200
A004 .... 300
B006 .... 100
Please use [ c o d e ] and [ / c o d e ] tags when displaying code or output from logs/errors etc., ty
  #3 (permalink)  
Old 07-21-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Question You can sometimes 'fool' grep by playing with the line layout

It is unclear what you are trying to look for. However, sometimes a file can be re-formatted to combine multiple related lines into one - so grep can work - and then the file broken back into pieces.

This is done with a "tr" command.

If you provide more on what you are trying to learn from this file, someone may be able to assist in extracting the information.
  #4 (permalink)  
Old 07-21-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,212
With grep you can simply print 2 lines before and 1 line after the pattern as follow:

Code:
 grep -B 2 -A 1 '^ERROR at line' file
Regards
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:27 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0