Sponsored Content
Top Forums Shell Programming and Scripting Delete db records from shell script Post 302956692 by RudiC on Friday 2nd of October 2015 05:31:32 AM
Old 10-02-2015
How about
Code:
/usr/bin/mysql --user=$MYSQL_USER --password=$MYSQL_PASS $MYSQL_DB <<EOF
$(awk '{print "delete from numberlist where msidn=" sq $1 sq ";"}' sq="'" file)
EOF

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script needed to select and delete lower case and mixed case records

HELLO ALL, URGENTLY NEEDED A SCRIPT TO SELECT AND DELETE LOWER AND MIXED CASE RECORDS FROM A COLUMN IN A TABLE. FOR EXAMPLE : Table name is EMPLOYEE and the column name is CITY and the CITY column records will be: Newyork washington ... (1 Reply)
Discussion started by: abhilash mn
1 Replies

2. Shell Programming and Scripting

how to add, updat, and delete records using shell

thax for replying (5 Replies)
Discussion started by: sarah2009
5 Replies

3. UNIX for Dummies Questions & Answers

update records in a file using shell script...

Hi, I have a file with 6 columns. First 3 columns together make unique record. I have a variable ($v) which hold a value that is obtained by a caliculaion. I have to replace value in 5th columnn with the value of the variable ($v). The value $v is caliculated from col4 and col6 values. ... (2 Replies)
Discussion started by: new_learner
2 Replies

4. Shell Programming and Scripting

need shell script to read particular records from a file

i am reading an i/p file input.txt as below and want to read all filenames as in highlighted in bold below and put them in a different file output.txt. can someone help me with a shell script to do this? thanks in advance regards brad input.txt --------- START TYPE:OPT INIT_SEQ:01... (8 Replies)
Discussion started by: bradc
8 Replies

5. Shell Programming and Scripting

Help with shell script in formatting the records.

I have a text file in the following format. can any one please help me in printing the output in userfriendly format mentioned below. Input. 1) /ss/abc/1/w/s/domainname/abc1/logname/ ########error################### ########error################### ########error###################... (2 Replies)
Discussion started by: vinny81
2 Replies

6. Shell Programming and Scripting

count and compare no of records in bash shell script.

consider this as a csv file. H,0002,0002,20100218,17.25,P,barani D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 D,1,2,3,4,5,6,7,8,9,10,11 T,5 N i want to read the csv file and count the number of rows that start with D and... (11 Replies)
Discussion started by: barani75
11 Replies

7. Shell Programming and Scripting

Shell script to print date and no.of records

hi all, i want script to print the output in the following format filename yyyy/mm/dd count where count= no.of records in the file Thanks in advance hemanthsaikumar (11 Replies)
Discussion started by: hemanthsaikumar
11 Replies

8. Shell Programming and Scripting

Shell script for insert multiple records into a Database

I have a table in an Informix DB into which I want to insert multiple records at a time. Data for one of the column should be unique & other column data may be the same for all the records I insert Typical Insert Statement I use to insert one row : insert into employee(empid, country, state)... (5 Replies)
Discussion started by: nisav
5 Replies

9. Shell Programming and Scripting

Extract top 20 records from sybase db in shell script

Hi, I am new to advanced scripting. I need to get top 20 records from database (Sybase) with a condition that all Char/varchar columns should have more than 4 characters. I need to do this via shell scripting, I have got half logic (on how to get varchar/char columns and stored it in a... (2 Replies)
Discussion started by: Selva_2507
2 Replies

10. Shell Programming and Scripting

Shell script matching similar records

hello all, I have requirement to identify similar records matching about 80% to 90%.I have to black list customers with multiple accounts. The data is in the Oracle Database, but is there any way I can get the data into flat file and compare the strings and fetch similar matching records? ... (2 Replies)
Discussion started by: kashik786
2 Replies
MYSQL(1)						      General Commands Manual							  MYSQL(1)

NAME
mysql - text-based client for mysqld, a SQL-based relational database daemon SYNOPSIS
mysql [-B|--batch] [-#|--debug= logfile] [-T|--debug-info] [-e|--exec= command] [-f|--force] [-?|--help] [-h|--host= hostname] [-n|--unbuffered] [-p[pwd]] [--password=[pwd]] [-P|--port= pnum] [-q|--quick] [-r|--raw] [-s|--silent] [-S|--socket= snum] [-u|--user= uname] [-v|--verbose] [-V|--version] [-w|--wait] DESCRIPTION
The mysql program provides a curses-based interface to the SQL-based database server daemon, mysqld(1). Full fuller documentation, refer to the HTML documents installed with the package. OPTIONS
-B|--batch Print results with a tab as separator, each row on a new line. -#|--debug=logfile Employ the specified debug log. -T|--debug-info Print debug information upon exiting. -e | --exec=command Execute the specified command and quit (--batch is implicit). -f|--force Continue even if the face of a SQL error. -?|--help Display a help message and exit. -h|--host=hostname Connect to the specified host. -n|--unbuffered Flush the buffer after each query. -p|--password[=pwd] Employ the specified password when connecting to the database server. If a password is not supplied, it will be requested interac- tively. -P|--port=pnum Employ the specified port number for connecting to the database server. -q|--quick Do not cache the result; print it row by row. This may slow down the server if the output is suspended. -r|--raw Write fields without conversion. (used with --batch). -s|--silent Silent mode: reduce the amount of output. -S|--socket=snum Employ the specified socket file for connecting to the database server. -u|--user=uname Employ the specified user name for logging in to the server. -v|--verbose Verbose mode: write more Specifying this option twice produces a tabular output format. -V|--version Print the mysql version number and exit. -w|--wait Wait and retry if the database server connection is down. FILES
/depot/bin/mysql executable /depot/bin/mysqld executable /depot/bin/safe_mysqld executable shell script for starting mysqld safely /site/var/mysql/data location of database files EXAMPLE
You can also read a backup dump file back into MySQL with: mysql database < backup-file.sql SEE ALSO
isamchk (1), isamlog (1), mysqlaccess (1), mysqladmin (1), mysqlbug (1), mysqld (1), mysqldump (1), mysqlshow (1), msql2mysql (1), perror (1), replace (1), safe_mysqld (1), which1 (1), zap (1), AUTHOR
Ver 6.3, distribution 3.20.20 Michael (Monty) Widenius (monty@tcx.se), TCX Datakonsult AB (http://www.tcx.se). This software comes with no warranty. Manual page by R. P. C. Rodgers, Lister Hill National Center for Biomedical Communication, U.S. National Library of Medicine (rodgers@nlm.nih.gov). 13 June 1997 MYSQL(1)
All times are GMT -4. The time now is 07:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy