Sponsored Content
Full Discussion: Partial Delete Lines
Top Forums Shell Programming and Scripting Partial Delete Lines Post 302421121 by Tytalus on Thursday 13th of May 2010 12:35:14 PM
Old 05-13-2010
This do for your needs ?

Code:
#  sed "s/[^']*'/'/" infile
' INSERT INTO TEST'
' UPDATE INTO TEST'
' DELETE INTO TEST'
This is test

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

delete line from file if successful partial string found

Id like to delete a line from a file using (preferably a single line unix command) if it contains a certain string pattern. If line contains "abcdef" then delete that line. Help greatly appreciated. (7 Replies)
Discussion started by: cronjob78
7 Replies

2. Shell Programming and Scripting

shell script to partial delete

guys i need some help in writing a shell script, what i am trying to write is a shell script that can delete generated trace files my software usually generated everyday, i will give an example to make it easy to understand root@cms-db # pwd /pcard17/trace root@cms-db # ls -l HSM_VERIF.TRC*... (4 Replies)
Discussion started by: q8devilish
4 Replies

3. Shell Programming and Scripting

How to delete lines in a file that have duplicates or derive the lines that aper once

Input: a b b c d d I need: a c I know how to get this (the lines that have duplicates) : b d sort file | uniq -d But i need opossite of this. I have searched the forum and other places as well, but have found solution for everything except this variant of the problem. (3 Replies)
Discussion started by: necroman08
3 Replies

4. UNIX for Dummies Questions & Answers

How to delete partial duplicate lines unix

hi :) I need to delete partial duplicate lines I have this in a file sihp8027,/opt/cf20,1980182 sihp8027,/opt/oracle/10gRelIIcd,155200016 sihp8027,/opt/oracle/10gRelIIcd,155200176 sihp8027,/var/opt/ERP,10376312 and need to leave it like this: sihp8027,/opt/cf20,1980182... (2 Replies)
Discussion started by: C|KiLLeR|S
2 Replies

5. Shell Programming and Scripting

AWK - Print partial line/partial field

Hello, this is probably a simple request but I've been toying with it for a while. I have a large list of devices and commands that were run with a script, now I have lines such as: a-router-hostname-C#show ver I want to print everything up to (and excluding) the # and everything after it... (3 Replies)
Discussion started by: ippy98
3 Replies

6. UNIX for Advanced & Expert Users

In a huge file, Delete duplicate lines leaving unique lines

Hi All, I have a very huge file (4GB) which has duplicate lines. I want to delete duplicate lines leaving unique lines. Sort, uniq, awk '!x++' are not working as its running out of buffer space. I dont know if this works : I want to read each line of the File in a For Loop, and want to... (16 Replies)
Discussion started by: krishnix
16 Replies

7. UNIX for Advanced & Expert Users

Grep returning partial lines due to special characters

Hey guys, I have a file with an ID which I'm using to grep out the original record from another file. Problem is I have special characters in the original file, and grep is returning only a partial record. How can I get around this? Appreciate your help! Pete (3 Replies)
Discussion started by: peteroc
3 Replies

8. Shell Programming and Scripting

search and replace, when found, delete multiple lines, add new set of lines?

hey guys, I tried searching but most 'search and replace' questions are related to one liners. Say I have a file to be replaced that has the following: $ cat testing.txt TESTING AAA BBB CCC DDD EEE FFF GGG HHH ENDTESTING This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies

9. Shell Programming and Scripting

Sed/awk to delete single lines that aren't touching other lines

Hello, I'm trying to figure out how to use sed or awk to delete single lines in a file. By single, I mean lines that are not touching any other lines (just one line with white space above and below). Example: one two three four five six seven eight I want it to look like: (6 Replies)
Discussion started by: slimjbe
6 Replies

10. Shell Programming and Scripting

Script to compare partial filenames in two folders and delete duplicates

Background: I use a TV tuner card to capture OTA video files (.mpeg) and then my Plex Media Server automatically optimizes the files (transcodes for better playback) and places them in a new directory. I have another Plex Library pointing to the new location for the optimized .mp4 files. This... (2 Replies)
Discussion started by: shaky
2 Replies
CREATE 
TRIGGER(7) SQL Commands CREATE TRIGGER(7) NAME
CREATE TRIGGER - define a new trigger SYNOPSIS
CREATE TRIGGER name { BEFORE | AFTER } { event [OR ...] } ON table FOR EACH { ROW | STATEMENT } EXECUTE PROCEDURE func ( arguments ) INPUTS name The name to give the new trigger. This must be distinct from the name of any other trigger for the same table. event One of INSERT, DELETE or UPDATE. table The name (optionally schema-qualified) of the table the trigger is for. func A user-supplied function that is declared as taking no arguments and returning type trigger. arguments An optional comma-separated list of arguments to be provided to the function when the trigger is executed, along with the standard trigger data such as old and new tuple contents. The arguments are literal string constants. Simple names and numeric constants may be written here too, but they will all be converted to strings. OUTPUTS CREATE TRIGGER This message is returned if the trigger is successfully created. DESCRIPTION
CREATE TRIGGER will enter a new trigger into the current data base. The trigger will be associated with the relation table and will execute the specified function func. The trigger can be specified to fire either before BEFORE the operation is attempted on a tuple (before constraints are checked and the INSERT, UPDATE or DELETE is attempted) or AFTER the operation has been attempted (e.g., after constraints are checked and the INSERT, UPDATE or DELETE has completed). If the trigger fires before the event, the trigger may skip the operation for the current tuple, or change the tuple being inserted (for INSERT and UPDATE operations only). If the trigger fires after the event, all changes, including the last insertion, update, or deletion, are ``visible'' to the trigger. If multiple triggers of the same kind are defined for the same event, they will be fired in alphabetical order by name. SELECT does not modify any rows so you can not create SELECT triggers. Rules and views are more appropriate in such cases. Refer to the chapters on SPI and Triggers in the PostgreSQL Programmer's Guide for more information. NOTES
To create a trigger on a table, the user must have the TRIGGER privilege on the table. In PostgreSQL versions before 7.3, it was necessary to declare trigger functions as returning the placeholder type opaque, rather than trigger. To support loading of old dump files, CREATE TRIGGER will accept a function declared as returning opaque, but it will issue a NOTICE and change the function's declared return type to trigger. As of the current release, STATEMENT triggers are not implemented. Refer to the DROP TRIGGER [drop_trigger(7)] command for information on how to remove triggers. EXAMPLES
Check if the specified distributor code exists in the distributors table before appending or updating a row in the table films: CREATE TRIGGER if_dist_exists BEFORE INSERT OR UPDATE ON films FOR EACH ROW EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did'); Before cancelling a distributor or updating its code, remove every reference to the table films: CREATE TRIGGER if_film_exists BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did'); The second example can also be done by using a foreign key, constraint as in: CREATE TABLE distributors ( did DECIMAL(3), name VARCHAR(40), CONSTRAINT if_film_exists FOREIGN KEY(did) REFERENCES films ON UPDATE CASCADE ON DELETE CASCADE ); COMPATIBILITY
SQL92 There is no CREATE TRIGGER statement in SQL92. SQL99 The CREATE TRIGGER statement in PostgreSQL implements a subset of the SQL99 standard. The following functionality is missing: o SQL99 allows triggers to fire on updates to specific columns (e.g., AFTER UPDATE OF col1, col2). o SQL99 allows you to define aliases for the ``old'' and ``new'' rows or tables for use in the definition of the triggered action (e.g., CREATE TRIGGER ... ON tablename REFERENCING OLD ROW AS somename NEW ROW AS othername ...). Since PostgreSQL allows trigger procedures to be written in any number of user-defined languages, access to the data is handled in a language-specific way. o PostgreSQL only has row-level triggers, no statement-level triggers. o PostgreSQL only allows the execution of a stored procedure for the triggered action. SQL99 allows the execution of a number of other SQL commands, such as CREATE TABLE as triggered action. This limitation is not hard to work around by creating a stored procedure that executes these commands. SQL99 specifies that multiple triggers should be fired in time-of-creation order. PostgreSQL uses name order, which was judged more conve- nient to work with. SEE ALSO
CREATE FUNCTION [create_function(7)], ALTER TRIGGER [alter_trigger(l)], DROP TRIGGER [drop_trigger(l)], PostgreSQL Programmer's Guide SQL - Language Statements 2002-11-22 CREATE TRIGGER(7)
All times are GMT -4. The time now is 03:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy