Sponsored Content
Full Discussion: Selective delete in SQL
Top Forums UNIX for Dummies Questions & Answers Selective delete in SQL Post 302772471 by sonia102 on Monday 25th of February 2013 07:42:01 PM
Old 02-25-2013
Hi,

I thought about it and realized that i could delete all unwanted entries in the mysql databaseb by using a select and delete command
i want to retain only those seq1 entries whose stop_id is less than or equal to 1000000( ie from 0 to 1000000 )

I want to delete all other sequences from seq2 to 13 and also other entries having name VCC and QAC


Code:
id start_id stop_id
seq1 3333 66663
seq1 213267 723560
seq1 900000 1000000
seq1 12348965 19968965
seq2 2333 5623
seq1 2033333 2279800
seq3 213267 723560
seq2 900000 1000000
QAC 203333 229800
seq1 4532113 7633115
VCC 33333 3421111

I want only seq1 in the database having stop id<=1000000 .

required o/p looks like :

Code:
seq1 3333 66663
seq1 213267 723560
seq1 900000 1000000

Is there a way to delete all entries other than that required?

---------- Post updated at 07:42 PM ---------- Previous update was at 07:24 PM ----------

Also another question is to reduce the file size. Is there any command to check the count size of a file.

I am asking this because I have to retain the first 100Mb of data in seq1 and then deleting the remaining bits in that file.

What command should I use to retain the first 100 mb of file and delete the remaining bits using vi or awk?

Sorry for so many posts .Thanks ALL for your help
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Trying to delete a directory pattern-selective deletion

Trying to delete a directory or a file using a pattern-selective deletion (using “*” and “?” ) (4 Replies)
Discussion started by: herberwz
4 Replies

2. UNIX for Dummies Questions & Answers

Help with selective ls

Hi all :wall: Can anyone advise how do I use ls to do a selective amd sorted listing of file that I want to have as below? Am looking for files that are named as log_<nnnn>.txt, where <nnnn> are numeric, i.e. I want to have a listing sorted from the newest to the oldest of files that... (7 Replies)
Discussion started by: newbie_01
7 Replies

3. Shell Programming and Scripting

RegEx - selective delete around a pattern

I need RegEx to delete text block delimited by "^--" and "^request saved" if the block contained the pattern "FAILED:No air,rail,hotel or car" in the following. Many thanks in advance! company_id=9292 queue_id=72 internationalOnly=0 Building XML... ABC123 Adding passenger first=First ... (1 Reply)
Discussion started by: roshansharma
1 Replies

4. Shell Programming and Scripting

Capture rows for a column in file from delete sql -Oracle

Hi, This may not be the right forum but i am hoping someone knows an answer to this. I have to capture rows for a column that was deleted. How can i do that without having to write a select query? delete from myschema.mytable where currentdatetimestamp > columnDate this should delete 5... (4 Replies)
Discussion started by: jakSun8
4 Replies

5. UNIX for Dummies Questions & Answers

[Solved] Selective delete command

Hi All. I didnt know how to put this question as but i want to delete my values following string_X but need to retain the data in it. I hope the following might help me in conveying my doubt. My sequence looks like this. >string_1 CAJW010000001... (3 Replies)
Discussion started by: sonia102
3 Replies

6. UNIX for Dummies Questions & Answers

SQL selective replace

Hi I have a table which looks like this id | name | length | clone | null 1 | string 1 | 12345643 | string 1 | NULL | 2 | string 2 | 2345612 | string 2 | NULL | 3 | string 3 | 3421556 | string 3 | NULL | 4 | string 4 | 1236742 | string 4 | NULL | 5 | string 5 | 2312677 | string 5 | NULL |... (2 Replies)
Discussion started by: rsi.245
2 Replies

7. UNIX for Dummies Questions & Answers

Sql delete and append

Hi I have a question on appending and deleting entries in mysql table. This is my sample table. table name: details id_name | model | mode | media| first | end | id | level | +--------------------+-------+---------+-----+-------+-------+--------+--------+ | PSK_30s1207681L002 | -1 | 1... (7 Replies)
Discussion started by: rsi.245
7 Replies

8. UNIX for Dummies Questions & Answers

Selective replace and delete

Hi My input file looks like this: >BAHMI01000090.1 Details of the shopping list 9800 item00090, whole set of listed artifacts and objects >BAHMI01050012.1 Details of the shopping list 9800 item02310, whole set of listed artifacts and objects >BAHMI01070078.1 Details of the shopping list ... (5 Replies)
Discussion started by: sonia102
5 Replies

9. UNIX and Linux Applications

How to delete a data starting with a phrase in a table - SQL?

Hello, I am trying to remove some rows in a table, which are including a phrase at a defined column but i could not find the unique result for this. What I wish to do is to remove all lines including http://xx.yy at link column ... (2 Replies)
Discussion started by: baris35
2 Replies

10. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
GLOBUS-GRAM-AUDIT(8)						  GRAM5 Commands					      GLOBUS-GRAM-AUDIT(8)

NAME
globus-gram-audit - Load GRAM4 and GRAM5 audit records into a database SYNOPSIS
globus-gram-audit [--conf CONFIG_FILE] [[--create] | [--update=OLD-VERSION]] [--check] [--delete] [--audit-directory AUDITDIR] [--quiet] DESCRIPTION
The globus-gram-audit program loads audit records to an SQL-based database. It reads $GLOBUS_LOCATION/etc/globus-job-manager.conf by default to determine the audit directory and then uploads all files in that directory that contain valid audit records to the database configured by the globus_gram_job_manager_auditing_setup_scripts package. If the upload completes successfully, the audit files will be removed. The full set of command-line options to globus-gram-audit consist of: --conf CONFIG_FILE Use CONFIG_FILE instead of the default from the configuration file for audit database configuration. --check Check whether the insertion of a record was successful by querying the database after inserting the records. This is used in tests. --delete Delete audit records from the database right after inserting them. This is used in tests to avoid filling the databse with test records. --audit-directory DIR Look for audit records in DIR, instead of looking in the directory specified in the job manager configuration. This is used in tests to control which records are loaded to the database and then deleted. --query SQL Perform the given SQL query on the audit database. This uses the database information from the configuration file to determine how to contact the database. --quiet Reduce the amount of output for common operations. FILES
The globus-gram-audit uses the following files (paths relative to $GLOBUS_LOCATION. etc/globus-gram-job-manager.conf GRAM5 job manager configuration. It includes the default path to the audit directory etc/globus-gram-audit.conf Audit configuration. It includes the information needed to contact the audit database. University of Chicago 08/30/2011 GLOBUS-GRAM-AUDIT(8)
All times are GMT -4. The time now is 10:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy