Sponsored Content
Top Forums Shell Programming and Scripting delete rows between closest pattern or range Post 302388677 by gaurav1086 on Thursday 21st of January 2010 05:29:00 AM
Old 01-21-2010
hi..

with perl I can write something like this.

Code:
gaurav@localhost:~$ echo 'WARNING
<some text in n number of lines>
ERROR:2597
WARNING
<some text in n number of lines>
ERROR:0000
WARNING
<some text in n number of lines>
ERROR:4578
WARNING
<some text in n number of lines>
ERROR:1344
WARNING
<some text in n number of lines>
ERROR:0000
WARNING
<some text in n number of lines>
ERROR:3456' | perl -wln -e 'push(@arr,$_);if(/^WARNING/){$n=1;}elsif(/^ERROR:[1-9]{4}/){for($k=0;$k<=$n;$k++){print $arr[$k];}}elsif(/ERROR:0000/){$n=0}else{$n++}'
WARNING
<some text in n number of lines>
ERROR:2597
WARNING
<some text in n number of lines>
ERROR:2597
WARNING
<some text in n number of lines>
ERROR:2597
WARNING
<some text in n number of lines>
ERROR:2597
gaurav@localhost:~$

Regards,
Gaurav.

Last edited by gaurav1086; 01-21-2010 at 06:31 AM.. Reason: code trimming
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk or sed for finding closest pattern to a line number

hi guys, I want to do pattern matching with awk or sed but I don't know how. here's what I want: I have a line number for a pattern that I have already found using grep, and I know a pattern like "---" that happens a few lines above that certain line number. I want to print out the chunk... (1 Reply)
Discussion started by: alirezan
1 Replies

2. Shell Programming and Scripting

print range between two patterns if it contains a pattern within the range

I want to print between the range two patterns if a particular pattern is present in between the two patterns. I am new to Unix. Any help would be greatly appreciated. e.g. Pattern1 Bombay Calcutta Delhi Pattern2 Pattern1 Patna Madras Gwalior Delhi Pattern2 Pattern1... (2 Replies)
Discussion started by: joyan321
2 Replies

3. UNIX for Advanced & Expert Users

sed match closest/nearest pattern

All i am struggling to raplace some text in a line between two (closest) patterns , line="/home/usr/bin/:/home/usr/devuser,n1.9/bin:/home/usr/root/bin" i want to replace "devuser,n1.9" with "NEWVAL", basically all teh text from "devuser" until nearest '/' with some new text. i tried teh... (1 Reply)
Discussion started by: sudheer1984
1 Replies

4. Shell Programming and Scripting

Closest Number from a Range of Numbers

out of a range of numbers, how can i pick out the number that is the closest to any arbitrary/random number that a user supplies? say the range of numbers are between 1 - 90000. but that doesn't mean each number exist between 1 - 90000. the range of numbers could be for example: 1, 3, 4, 6,... (6 Replies)
Discussion started by: SkySmart
6 Replies

5. UNIX for Dummies Questions & Answers

Extracting rows from a text file if the value of a column falls between a certain range

Hi, I have a file that looks like the following: 10 100080417 rs7915867 ILMN_1343295 12 6243093 7747537 10 100190264 rs2296431 ILMN_1343295 12 6643093 6647537 10 100719451 SNP94374 ILMN_1343295 12 6688093 7599537 ... (1 Reply)
Discussion started by: evelibertine
1 Replies

6. UNIX for Dummies Questions & Answers

Awk: how to copy a range of rows in GAMS environment

Hi I have a problem in using awk in GAMS. I have to copy a part of a .txt file selecting the rows between these two lines "0 / END OF TRANSFORMER DATA, BEGIN AREA DATA" "0 / END OF AREA DATA, BEGIN TWO-TERMINAL DC DATA" I thought of using a command like this: $onecho > area.awk... (4 Replies)
Discussion started by: Pintug
4 Replies

7. Shell Programming and Scripting

Sum of range of rows and columns in matrix

Hi all, I have a large matrix of 720 x 25. I want to get sum of range of rows and columns. Like, I need sum of all columns and row number 2 to 21, then leaving 22nd row, again sum of all columns and row number 23 to 42 again leaving 43rd row and then sum of 44th to 63. Means I want to add all... (4 Replies)
Discussion started by: CAch
4 Replies

8. Shell Programming and Scripting

Printing rows based on column range

Hello, I have a file with nearly 57K lines. I want to filter the lines based on the range of values in a column. For e.g. print lines whose 3rd filed is >=0.02. Input file: LOC_Os09g32030 LOC_Os02g18880 0.0200037219149773 undirected NA NA LOC_Os03g58630 LOC_Os09g35690 ... (1 Reply)
Discussion started by: Sanchari
1 Replies

9. Shell Programming and Scripting

Concatenate rows and redefine range

I'm trying to find a way to concatenate consecutive rows (key is column $1 and $2) if column $5 an $6 are integers and redefine ranges in columns $3&$4 and $5&$6 Unfortunately I'm still learning the very basics so I cannot figure a way of doing this with awk. Input file 15 30 21 21 25.0... (11 Replies)
Discussion started by: alex2005
11 Replies

10. Shell Programming and Scripting

sed Range Pattern and 2 lines before Start Pattern

Hi all, I have been searching all over Google but I am unable to find a solution for a particular result that I am trying to achieve. Consider the following input: 1 2 3 4 5 B4Srt1--Variable-0000 B4Srt2--Variable-1111 Srt 6 7 8 9 10 End (3 Replies)
Discussion started by: y2jacky
3 Replies
NDB_SETUP.PY(1) 					       MySQL Database System						   NDB_SETUP.PY(1)

NAME
ndb_setup.py - Start browser-based Auti-Installer for MySQL Cluster SYNOPSIS
ndb_setup.py [options] DESCRIPTION
ndb_setup.py starts the MySQL Cluster Auto-Installer and opens the installer's Start page in the default Web browser. This section describes usage of and program options for the command-line tool only. For information about using the Auto-Installer GUI that is spawned when ndb_setup.py is invoked, see Section 17.2.1, "The MySQL Cluster Auto-Installer". Usage All platforms: ndb_setup.py [options] Additionally, on Windows platforms only: setup.bat [options] The following table includes all options that are supported by the MySQL Cluster installation and configuration program ndb_setup.py. Additional descriptions follow the table. Table 17.26. ndb_setup.py Options and Variables: MySQL Cluster NDB 7.3 +---------------------------------+--------------------------------------+-------------------------------------+ |Format | Description | Added / Removed | +---------------------------------+--------------------------------------+-------------------------------------+ | | Page that the web browser opens when | | | --browser-start- | starting. | All MySQL 5.6 based releases | | page=filename, | | | | | | | | -s | | | +---------------------------------+--------------------------------------+-------------------------------------+ | | File containing list of client | | | --ca-certs-file=filename, | certificates allowed to connect to | All MySQL 5.6 based releases | | | the | | | -a | server | | +---------------------------------+--------------------------------------+-------------------------------------+ | | File containing X509 certificate | | | --cert-file=filename, | that identifies the server. | All MySQL 5.6 based releases | | | (Default: | | | -c | cfg.pem) | | +---------------------------------+--------------------------------------+-------------------------------------+ | | Python logging module debug level. | | | --debug-level=level, | One of DEBUG, INFO, WARNING | All MySQL 5.6 based releases | | | (default), ERROR, or | | | -d | CRITICAL. | | +---------------------------------+--------------------------------------+-------------------------------------+ | | Print help message | | | --help, | | All MySQL 5.6 based releases | | | | | | -h | | | +---------------------------------+--------------------------------------+-------------------------------------+ | | Specify file containing private key | | | --key-file=file, | (if not included in --cert-file) | All MySQL 5.6 based releases | | | | | | -k | | | +---------------------------------+--------------------------------------+-------------------------------------+ | | Do not open the start page in a | | | --no-browser, | browser, merely start the tool | All MySQL 5.6 based releases | | | | | | -n | | | +---------------------------------+--------------------------------------+-------------------------------------+ | | Specify the port used by the web | | | --port=#, | server | All MySQL 5.6 based releases | | | | | | -p | | | +---------------------------------+--------------------------------------+-------------------------------------+ | | Log requests to this file. Use '-' | | | --server-log-file=file, | to force logging to stderr instead. | All MySQL 5.6 based releases | | | | | | o | | | +---------------------------------+--------------------------------------+-------------------------------------+ | | The name of the server to connect | | | --server-name=name, | with | All MySQL 5.6 based releases | | | | | | -N | | | +---------------------------------+--------------------------------------+-------------------------------------+ | | Use secure (HTTPS) client-server | | | --use-https, | connection | All MySQL 5.6 based releases | | | | | | -S | | | +---------------------------------+--------------------------------------+-------------------------------------+ o --browser-start-page=file, -s +--------------------+-------------------------------+ |Command-Line Format | --browser-start-page=filename | +--------------------+-------------------------------+ | | -s | +--------------------+-------------------------------+ | | Permitted Values | | +------------+------------------+ | | Type | string | | +------------+------------------+ | | Default | index.html | +--------------------+------------+------------------+ Specify the file to open in the browser as the installation and configuration Start page. The default is index.html. o --ca-certs-file=file, -a +--------------------+--------------------------+ |Command-Line Format | --ca-certs-file=filename | +--------------------+--------------------------+ | | -a | +--------------------+--------------------------+ | | Permitted Values | | +-----------+--------------+ | | Type | file name | | +-----------+--------------+ | | Default | [none] | +--------------------+-----------+--------------+ Specify a file containing a list of client certificates which are allowed to connect to the server. The default is an empty string, which means that no client authentication is used. o --cert-file=file, -c +--------------------+----------------------+ |Command-Line Format | --cert-file=filename | +--------------------+----------------------+ | | -c | +--------------------+----------------------+ | | Permitted Values | | +----------+-----------+ | | Type |file name | | +----------+-----------+ | | Default |cfg.pem | +--------------------+----------+-----------+ Specify a file containing an X509 certificate which identifies the server. It is possible for the certificate to be self-signed. The default is cfg.pem. o --debug-level=level, -d +--------------------+----------------------------+ |Command-Line Format | --debug-level=level | +--------------------+----------------------------+ | | -d | +--------------------+----------------------------+ | | Permitted Values | | +--------------+-------------+ | | Type | enumeration | | +--------------+-------------+ | | Default | WARNING | | +--------------+-------------+ | | Valid Values | DEBUG | | | +-------------+ | | | INFO | | | +-------------+ | | | ERROR | | | +-------------+ | | | CRITICAL | +--------------------+--------------+-------------+ Set the Python logging module debug level. This is one of DEBUG, INFO, WARNING, ERROR, or CRITICAL. WARNING is the default. o --help, -h +--------------------+-----------+ |Command-Line Format | --help | +--------------------+-----------+ | | -h | +--------------------+-----------+ Print a help message. o --key-file=file, -d +--------------------+---------------------+ |Command-Line Format | --key-file=file | +--------------------+---------------------+ | | -k | +--------------------+---------------------+ | | Permitted Values | | +---------+-----------+ | | Type | file name | | +---------+-----------+ | | Default | [none] | +--------------------+---------+-----------+ Specify a file containing the private key if this is not included in in the X509 certificate file (--cert-file). The default is an empty string, which means that no such file is used. o --no-browser, -n +--------------------+--------------+ |Command-Line Format | --no-browser | +--------------------+--------------+ | | -n | +--------------------+--------------+ Start the installation and configuration tool, but do not open the Start page in a browser. o --port=#, -p +--------------------+----------------------+ |Command-Line Format | --port=# | +--------------------+----------------------+ | | -p | +--------------------+----------------------+ | | Permitted Values | | +---------+------------+ | | Type | numeric | | +---------+------------+ | | Default | 8081 | | +---------+------------+ | | Range | 1 .. 65535 | +--------------------+---------+------------+ Set the port used by the web server. The default is 8081. o --server-log-file=file, -o +--------------------+----------------------------------+ |Command-Line Format | --server-log-file=file | +--------------------+----------------------------------+ | | o | +--------------------+----------------------------------+ | | Permitted Values | | +--------------+-------------------+ | | Type | file name | | +--------------+-------------------+ | | Default | ndb_setup.log | | +--------------+-------------------+ | | Valid Values | - (Log to stderr) | +--------------------+--------------+-------------------+ Log requests to this file. The default is ndb_setup.log. To specify logging to stderr, rather than to a file, use a - (dash character) for the file name. o --server-name=host, -N +--------------------+---------------------+ |Command-Line Format | --server-name=name | +--------------------+---------------------+ | | -N | +--------------------+---------------------+ | | Permitted Values | | +---------+-----------+ | | Type | string | | +---------+-----------+ | | Default | localhost | +--------------------+---------+-----------+ Specify the host name or IP address for the browser to use when connecting. The default is localhost. o --use-https, -S +--------------------+-------------+ |Command-Line Format | --use-https | +--------------------+-------------+ | | -S | +--------------------+-------------+ Make the browser use a secure (HTTPS) connection with the server. COPYRIGHT
Copyright (C) 1997, 2014, Oracle and/or its affiliates. All rights reserved. This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. AUTHOR
Oracle Corporation (http://dev.mysql.com/). MySQL 5.6 01/29/2014 NDB_SETUP.PY(1)
All times are GMT -4. The time now is 11:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy