Sponsored Content
Top Forums Shell Programming and Scripting String search and print next all lines in one line until blank line Post 302853005 by jaydeep_sadaria on Friday 13th of September 2013 03:22:16 AM
Old 09-13-2013
String search and print next all lines in one line until blank LINE

Dear all

one more of similir proble. i used below code but it does not give complete result to me.

Code:
awk '/A1\/EXT/{ p=$2 OFS $3 OFS $4 OFS $5 } /EXTERNAL ALARM/{$1=$2=x; p=p OFS $0; print p}' RS = i/pfile

-- this give only first line op.(*** ALARM 584 A1/EXT "BSCABD1_21233G1"U 130908 0120)

i/p file:

Code:
*** ALARM 584 A1/EXT "BSCABD1_21233G1"U 130908 0120
EXTERNAL ALARM

AP    APNAME         NODE      NODENAME
 1    AP080428645C   B         AP080428645B

AMAPP
FIRE
MANISFAIL


DEV
EXAL-1-26


output neededSmilieIN ONE LINE)
Code:
*** ALARM 584 A1/EXT "BSCABD1_21233G1"U 130908 0120 AMAZONEPP FIRE MANIS FAIL

Guide for same.

Regards
jaydeep

Last edited by Scrutinizer; 09-14-2013 at 01:12 PM.. Reason: additional code tags for data
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use sed to search for string and Print previous two lines and current line

Hello, Can anybody help me to correct my sed syntax to find the string and print previous two lines and current line and next one line. i am using string as "testing" netstat -v | sed -n -e '/test/{x;2!p;g;$!N;p;D;}' -e h i am able to get the previous line current line next line but... (1 Reply)
Discussion started by: nmadhuhb
1 Replies

2. Shell Programming and Scripting

Unix help to find blank lines in a file and print numbers on that line

Hi, I would like to know how to solve one of my problems using expert unix commands. I have a file with occasional blank lines; for example; dertu frthu fghtu frtty frtgy frgtui frgtu ghrye frhutp frjuf I need to edit the file so that the file looks like this; (10 Replies)
Discussion started by: Lucky Ali
10 Replies

3. Shell Programming and Scripting

Search a string and print the rest of line

Hi Guys, I need to search a string and print the rest of the lines... input: 8 0 90 1 0 59 20 2488 96 30006dde372 S ? 0:00 /etc/opt/SUNWconn/atm/bin/atmsnmpd -n output: 00 /etc/opt/SUNWconn/atm/bin/atmsnmpd -n Actually i don even need the first "00".. any suggestions is appreciated..... (13 Replies)
Discussion started by: mac4rfree
13 Replies

4. Shell Programming and Scripting

awk print second line after search string

I have multiple config files where I need to pull the ip address from loopback3. The format is the same in every file, the ip is the second line after interface loopback3. interface loopback2 loopback description router ID ip address 192.168.1.1 interface loopback3 loopback description... (3 Replies)
Discussion started by: numele
3 Replies

5. Shell Programming and Scripting

Print lines after the search string until blank line is found

All I want is to look for the pattern in the file...If I found it at # places... I want print lines after those pattern(line) until I find a blank line. Log EXAMPLE : MT:Exception caught The following Numbers were affected: 1234 2345 2346 Error java.lang.InternalError:... (3 Replies)
Discussion started by: prash184u
3 Replies

6. Shell Programming and Scripting

search string in a file and retrieve 10 lines including string line

Hi Guys, I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same. can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies

7. Shell Programming and Scripting

Search for string and print top and bottom line

Hi Folks I need a one liner to parse through a log and if the string is found print the line above, the line with the string and the line below. example: The ball is green and blue Billy through the ball higer. Jane got hurt with the ball. So if I search for Billy I would need the 3... (1 Reply)
Discussion started by: bombcan
1 Replies

8. Shell Programming and Scripting

Print lines between a regExp & a blank line

Hi, I have a file, say files_list, as below (o/p of ls -R cmd) $ cat files_list /remote/dir/path/to/file: sub-dir1 sub-dir2 sub-dir3 ... /remote/dir/path/to/file/sub-dir1: remote_file1.csv.tgz <blank line 1> /remote/dir/path/to/file/sub-dir2: remote_file2.csv.tgz <blank... (3 Replies)
Discussion started by: dips_ag
3 Replies

9. Shell Programming and Scripting

Search words in a line and print next 15 lines.

I have a text file ( basically a log file) and i have 2 words (alpha, beta), Now i want to search these two words in one line and then print next 15 lines in a temp file. there would be many lines with alpha and beta But I need only last occurrence with "alpha" and "beta" and next 15 lines. ... (4 Replies)
Discussion started by: kashif.live
4 Replies

10. Shell Programming and Scripting

Search string and print the above line and below lines?.

if the first string matches then print the previous line and current line and also print the following lines if the other string search matches. Input ------ TranTime 2012 10 12 The Record starts here Accountnumber: 4632473431274 TxnCode 323 TranID 329473242834 ccsdkcnsdncskd... (7 Replies)
Discussion started by: laknar
7 Replies
g3cat(1)						       mgetty+sendfax manual							  g3cat(1)

NAME
g3cat - concatenate multiple g3 documents SYNOPSIS
g3cat [-l] [-a] g3-file1 ... DESCRIPTION
g3cat concatenates g3 files. These can either be 'raw', that is, bitmaps packed according to the CCITT T.4 standard for one-dimensional bitmap encoding, or 'digifax' files, created by GNU's GhostScript package with the digifax drivers. Its output is a concatenation of all the input files, in raw G3 format, with two white lines in between. If a - is given as input file, stdin is used. If the input data is malformed, a warning is printed to stderr, and the output file will have a blank line at this place. OPTIONS
-l separate files with a one-pixel wide black line. -h <blank lines> specifies the number of blank lines g3cat should prepend to each page. Default is 0. -L <lines> limit lenght of output page to maximum <lines> lines. SPECIAL-CASE OPTIONS -w <width> specifies the desired page width in pixels per line. Default is 1728 PELs, and this is mandatory if you want to send the fax to a standard fax machine. If one of the input files doesn't match this line width (for example because it was created by a broken G3 creator), a warning is printed, and the line width is transparently fixed. -a byte-align the end-of-line codes (EOL) in the file. Every EOL will end at a byte boundary, that is, with a 01 byte. -p <pad> specifies a minimum number of bytes that each output line must be padded to. Padding is done with 0-bits before the EOL code. -R suppress output of end-of-page code (RTC). Example The following example will put a header line on a given g3 page, 'page1' and put the result into 'page2': echo '$header' | pbmtext | pbm2g3 | g3cat - page1 >page2 FILES
-- BUGS
Hopefully none :-). SEE ALSO
g32pbm(1), sendfax(8), faxspool(1) AUTHORS
g3cat is Copyright (C) 1993 by Gert Doering, <gert@greenie.muc.de> greenie 27 Oct 93 g3cat(1)
All times are GMT -4. The time now is 09:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy