Hi,
how can i print the previous, current and next line using sed?
current line is the matching line.
The following prints all lines containing 'Failure' and also the immediate next line
cat $file | sed -n -e '/Failure/{N;p;}'
Now, i also want to print the previous line too.
Thanks,... (8 Replies)
Ok I have a file with hundreds of lines, four columns, space delimited, TESTB.TXT for example
TESTB.TXT
---
AA ZZ 12 34
BB YY 56 78
CC XX 91 23
DD VV 45 67
---
I want a new file that has 7 columns, the first four are identical, and the next 3 are the last three of the next line...so... (5 Replies)
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)
Hi,
I have one small doubt how to go ahead and process the below requirement.
File Content
1,abc,10
2,xyz,11
3,pqr,12
4,pqr,13
5,pqr,14
Output file expected:
1,mnq,1
1,ddd,2
1,qqq,3
1,sss,4
1,ddd,5
1,eee,6
1,fff,7
1,ddr,8
1,rrd,9 (3 Replies)
I need to read the contents of a file. Then I need to grep for a keyword and replace part of the grepped line based on the condition of previous and present line.
Example input file:
V {
port1 = P;
port2 = 0;
shift_port = P0; /* if next shift_port is P0 I need... (9 Replies)
I am trying to delete lines in archived Apache httpd logs
Each line has the pattern:
<ip-address> - - <date-time> <document-request-URL> <http-response> <size-of-req'd-doc> <referring-document-URL>
This pattern is shown in the example of 6 lines from the log in the code box below. These 6... (1 Reply)
Hi all,
From a while loop I am reading a sorted file where I want to print only the lines that have $1 match and $2 only when the difference from $2 from the previous line is > 30.
Input would be like ...
AN237 010 193019 0502 1 CSU Amoxycillin
AN237 080 ... (2 Replies)
Hello,
I have below format log file,
Comparing csv_converted_files/2201/9747.1012H67126.5077292103609547345.csv and csv_converted_files/22019/97447.1012H67126.5077292103609547345.csv
Comparing csv_converted_files/2559/9447.1012H67126.5077292103609547345.csv and... (6 Replies)
Hi All,
I need to print the characters in the previous line just before the regular expression match
Please have a look at the input file as attached
I need to match the regular expression ^ with the character of the previous like and also the pin numbers
and the output file should be like... (6 Replies)
Discussion started by: kshitij
6 Replies
LEARN ABOUT SUSE
bcomps
BCOMPS(1) General Commands Manual BCOMPS(1)NAME
bcomps - biconnected components filter for graphs
SYNOPSIS
bcomps [ -stvx? ] [ -ooutfile ] [ files ]
DESCRIPTION
bcomps decomposes graphs into their biconnected components, printing the components to standard output.
OPTIONS
The following options are supported:
-s No output graph is printed. Implies the -v flag.
-t Print the underlying block-cutvertex tree.
-x Each biconnected component is printed as a separate root graph.
-v Prints number of blocks and cutvertices.
-o outfile
If specified, each root graph will be written to a different file with the names derived from outfile. In particular, if both -o and
-x flags are used, then each block is written to a different file. If outfile does not have a suffix, the nth block of the ith graph
is written to outfile_n_i. However, the 0th block of the 0th graph is written to outfile.
If outfile has a suffix, i.e., has the form base.sfx, then the files will have the same name as above, except appended with .sfx.
The block-cutvertex tree of ith graph is written to outfile_n_T, with an appended suffix if specified.
By default, each input graph is printed, with each block given as a subgraph whose name is a concatenation of the name of the input graph,
the string "_bcc_" and the number of the block.
OPERANDS
The following operand is supported:
files Names of files containing 1 or more graphs in dot format. If no files operand is specified, the standard input will be used.
RETURN CODES
bcomps returns 0 if all the input graphs are biconnected; and non-zero if any graph has multiple blocks, or any error occurred.
BUGS
It is possible, though unlikely, that the names used for connected components and their subgraphs may conflict with existing subgraph
names.
AUTHORS
Emden R. Gansner <erg@research.att.com>
SEE ALSO ccomps(1), gc(1), dot(1), gvpr(1), gvcolor(1), acyclic(1), sccmap(1), tred(1), libgraph(3)
18 November 2003 BCOMPS(1)