Sponsored Content
Top Forums Shell Programming and Scripting Sorting lines based on keywords for MySQL script Post 302587791 by jayan_jay on Friday 6th of January 2012 02:38:22 AM
Old 01-06-2012
Based on the input given .. Try with this ..
Code:
$ cat file_to_run
for i in $(nawk '/CREATE VIEW /{print $NF}' delta.sql)
do
        parent_view=$(sed -n "/CREATE VIEW $i/,/id;/p" delta.sql | nawk '/FROM/{print $2}')
        sed -n "/CREATE VIEW $i/q;p" delta.sql | grep "CREATE VIEW $parent_view" > /dev/null
        [ $? -eq 0 ] && echo "$i --> Success" || echo "$i --> Failure"
done < delta.sql
$
$ ./file_to_run
Austin --> Failure
Chester --> Failure
Barabara --> Success
Zithorn --> Success
$

This User Gave Thanks to jayan_jay For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture lines based on keywords

Hello everyone, I am trying to write a script that will capture few lines from a text file based on 2 keywords in the first line and 1 keyword in the last one. It could also be based on the first line only + the folllowing 3 lines. Could some one help or give directions. Thanks. (4 Replies)
Discussion started by: nimo
4 Replies

2. UNIX for Advanced & Expert Users

Forwarding based on keywords in sendmail

I have an application that runs on the server with root privileges and all emails it sends get sent to root (errors, logs, etc), when they should actually go to one of application admins. I would like to separate these emails from the OS related one sent to root and forward them to that... (2 Replies)
Discussion started by: vostrushka
2 Replies

3. Shell Programming and Scripting

sorting based on alternative lines

Hello, I have a file with multiple entries. @SFGF-GA2-1_58:5:36:11009:999#0/1 NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN +SFGF-GA2-1_58:5:36:11009:999#0/1 ################################################################################... (10 Replies)
Discussion started by: Diya123
10 Replies

4. Shell Programming and Scripting

copy range of lines in a file based on keywords from another file

Hi Guys, I have the following problem. I have original file (org.txt) that looks like this module v_1(.....) //arbitrary number of text lines endmodule module v_2(....) //arbitrary number of text lines endmodule module v_3(...) //arbitrary number of text lines endmodule module... (6 Replies)
Discussion started by: kaaliakahn
6 Replies

5. Shell Programming and Scripting

HELP: Shell Script to read a Log file line by line and extract Info based on KEYWORDS matching

I have a LOG file which looks like this Import started at: Mon Jul 23 02:13:01 EDT 2012 Initialization completed in 2.146 seconds. -------------------------------------------------------------------------------- -- Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies

6. Shell Programming and Scripting

Extract lines from file using keywords using script

Hi I need some lines of text from input file using keywords. Inputfile IP IS 10.238.52.65 pun-ras-bng-mhs-01#context bsnl.in Card Status : 1:0, 2:1, 3:1, 4:1, 5:0, 6:0, 7:0, 8:0, 9:1, 10:0, 11:0, 12:0, 13:0, 14:1, Max Circuits: 1: 0, 2: 32768, ... (5 Replies)
Discussion started by: surender reddy
5 Replies

7. Shell Programming and Scripting

Sorting block of lines based on specified strings

Below is the part of contents of a file cat outputFile.txt :APP-MS-service_monitoring-118054-DiskFilling-S Description=Disk is getting filled. If Condition=If Event/Log Level(ANY) and matching substring &quot;DiskFilling&quot; Log: xx.x.x..xx.: 4 days 1:33:54.42 Date and time=03-18-2013... (2 Replies)
Discussion started by: vivek d r
2 Replies

8. Shell Programming and Scripting

Extracting words and lines based on keywords

Hello! I'm trying to process a text file and am stuck at 2 extractions. Hoping someone can help me here: 1. Given a line in a text file and given a keyword, how can I extract the word preceeding the keyword using a shell command/script? For example: Given a keyword "world" in the line: ... (2 Replies)
Discussion started by: seemad
2 Replies

9. Shell Programming and Scripting

Split content based on keywords

I need to split the file contents with multiple rows based on patterns Sample: Input: ABC101testXYZ102UKMNO1092testing ABC999testKMNValid Output: ABC101test XYZ102U KMN1092testing ABC999test KMNValid In this ABC , XYZ and KMN are patterns Continue here./mod] Please read forum... (1 Reply)
Discussion started by: Jairaj
1 Replies

10. UNIX for Beginners Questions & Answers

Split content based on keywords

I need to split the file contents with multiple rows based on patterns Sample: Input: ABC101testXYZ102UKMNO1092testing ABC999testKMNValid Output: ABC101test XYZ102U KMN1092testing ABC999test KMNValid In this ABC , XYZ and KMN are patterns (6 Replies)
Discussion started by: Jairaj
6 Replies
MYSQLBUG(1)						       MySQL Database System						       MYSQLBUG(1)

NAME
mysqlbug - generate bug report SYNOPSIS
mysqlbug DESCRIPTION
This program enables you to generate a bug report and send it to Oracle Corporation. It is a shell script and runs on Unix. The normal way to report bugs is to visit http://bugs.mysql.com/, which is the address for our bugs database. This database is public and can be browsed and searched by anyone. If you log in to the system, you can enter new reports. If you have no Web access, you can generate a bug report by using the mysqlbug script. mysqlbug helps you generate a report by determining much of the following information automatically, but if something important is missing, please include it with your message. mysqlbug can be found in the scripts directory (source distribution) and in the bin directory under your MySQL installation directory (binary distribution). Invoke mysqlbug without arguments: shell> mysqlbug The script will place you in an editor with a copy of the report to be sent. Edit the lines near the beginning that indicate the nature of the problem. Then write the file to save your changes, quit the editor, and mysqlbug will send the report by email. COPYRIGHT
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. 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
Sun Microsystems, Inc. (http://www.mysql.com/). MySQL 5.1 04/06/2010 MYSQLBUG(1)
All times are GMT -4. The time now is 04:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy