Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to find=grep or maybe sed/awk for multiple lines of text? Post 302997890 by newbie_01 on Monday 22nd of May 2017 05:47:41 AM
Old 05-22-2017
How to find=grep or maybe sed/awk for multiple lines of text?

Hi,

I am running the following:

Code:
PASS="username/password"
sqlplus -s << EOF | grep -v "^$"
$PASS
set feedback off
set heading off
set termout off
select name from v\$database ;
exit
EOF

Which gives

Code:
ERROR:
ORA-28002: the password will expire within 5 days
PSMP1

Can anyone advise how I can grep -v the first two lines? Basically I only want to exclude both lines if and only ORA-28002 is the ORA- error encountered. The ERROR: line seems to always precede ORA-28002.

At the moment, it works doing grep -v "^ORA-28002: the password will expire" | grep -v "^ERROR:", but just want to know if there is a shorter option.

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

using sed or grep to find exact match of text

Hi, Can anyone help me with the text editing I need here. I have a file that contains the following lines for example: (line numbers are for illustration only) 1 Hello world fantasy. 2 Hello worldfuntastic. 3 Hello world wonderful. I would like to get all those lines of text that... (5 Replies)
Discussion started by: risk_sly
5 Replies

2. Shell Programming and Scripting

How to awk/sed/grep lines which contains a pattern at a given position

Dear friends I am new to linux and was trying to split some files userwise in our linux server. I have a data file of 156 continuous columns named ecscr final. I want the script to redirect all the lines containing a pattern of 7 digits to separate files. I was using grep to do that,... (2 Replies)
Discussion started by: anoopvraj
2 Replies

3. UNIX for Dummies Questions & Answers

retrieve lines using sed, grep or awk

Hi, I'm looking for a command to retrieve a block of lines using sed or grep, probably awk if that can do the job. In below example, By searching for words "Third line2" i'm expecting to retrieve the full block starting with 'BEGIN' and ending with 'END' of the search. Example: ... (3 Replies)
Discussion started by: learning_linux
3 Replies

4. Shell Programming and Scripting

sed find and replace multiple lines

I am new to linux and would like to modify the contents of a file preferably using a one line. The situation is as follows <start> some lines "I am the string" "replace string" more lines here <end> In the above example,On encountering "I am the string", the "replace string "should be... (6 Replies)
Discussion started by: supersimha
6 Replies

5. UNIX for Dummies Questions & Answers

grep command to find multiple strings in multiple lines in a file.

I want to search files (basically .cc files) in /xx folder and subfolders. Those files (*.cc files) must contain #include "header.h" AND x() function. I am writing it another way to make it clear, I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Discussion started by: ritikaSharma
2 Replies

6. UNIX for Dummies Questions & Answers

grep/awk and bring multiple lines forward

Hello all, I have a question regarding grep and pulling the result forward to the next carriage return or line space. Sorry if I have terminology incorrect. I have the following data set. Line1 Line2 Line3 Line5 Line6 Line7 Line9 Line10 Line11 I would like to grep for a pattern... (5 Replies)
Discussion started by: klysdale
5 Replies

7. Shell Programming and Scripting

How to print the lines between the pattern using awk/grep/sed?

Hi, I need a help to search a pattern and print the multiple lines between them. Input file: Tue May 29 12:30:33 EDT 2012:threadWebContainer : 357:com.travimp.hotelierlinks.abba.service.RequestHandler.requestService(String, ITICSDataSet): hotelCancelReservation request: ... (4 Replies)
Discussion started by: aroragaurav.84
4 Replies

8. Shell Programming and Scripting

Print lines between two strings multiple occurencies (with sed, awk, or grep)

Hello, I can extract lines in a file, between two strings but only one time. If there are multiple occurencies, my command show only one block. Example, monfichier.txt contains : debut_sect texte L1 texte L2 texte L3 texte L4 fin_sect donnees inutiles 1 donnees inutiles 2 ... (8 Replies)
Discussion started by: theclem35
8 Replies

9. Shell Programming and Scripting

Awk/sed : help on:Filtering multiple lines to one:

Experts Good day, I want to filter multiple lines of same error of same day , to only 1 error of each day, the first line from the log. Here is the file: May 26 11:29:19 cmihpx02 vmunix: NFS write failed for server cmiauxe1: error 5 (RPC: Timed out) May 26 11:29:19 cmihpx02 vmunix: NFS... (4 Replies)
Discussion started by: rveri
4 Replies

10. Shell Programming and Scripting

awk to skip lines find text and add text based on number

I am trying to use awk skip each line with a ## or # and check each line after for STB= and if that value in greater than or = to 0.8, then at the end of line the text "STRAND BIAS" is written in else "GOOD". So in the file of 4 entries attached. awk tried: awk NR > "##"' "#" -F"STB="... (6 Replies)
Discussion started by: cmccabe
6 Replies
PASSWD.NNTP(5)						    InterNetNews Documentation						    PASSWD.NNTP(5)

NAME
passwd.nntp - Passwords for connecting to remote NNTP servers DESCRIPTION
The file pathetc/passwd.nntp contains host / name / password triplets for use when authenticating client programs to NNTP servers. This file is normally interpreted by NNTPsendpassword() in libinn(3). Blank lines and lines beginning with a number sign ("#") are ignored. All other lines should consist of three or four fields separated by colons: host:name:password host:name:password:style The first field is the name of a host, and is matched in a case-insensitive manner. (No detailed matching, such as comparing IP addresses, is done.) The second field is a user name, and the third is a password. If either the username or password is empty, then that portion of the authentication will not occur. (For example, a server may require only a username, in which case the password is not necessary. Note that a username is mandatory with AUTHINFO USER/PASS.) The optional fourth field specifies the type of authentication to use. At present, the only recognized "authentication style" is "authinfo"; this is also the default. It means that AUTHINFO USER/PASS commands are used to authenticate to the remote host. (These NNTP commands are described in RFC 4643.) For example: ## UUNET needs a password, MIT doesn't. mit.edu:bbn::authinfo uunet.uu.net:bbn:yoyoma:authinfo This file should not be world-readable. HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. $Id: passwd.nntp.pod 8822 2009-11-20 17:34:15Z iulius $ SEE ALSO
inn.conf(5), innd(8), libinn(3). INN 2.5.2 2010-02-08 PASSWD.NNTP(5)
All times are GMT -4. The time now is 05:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy