Sponsored Content
Top Forums Shell Programming and Scripting is it hard to extract particular lines & strings from the files?? Post 302257996 by radoulov on Thursday 13th of November 2008 02:25:28 PM
Old 11-13-2008
This is strange ...
This is the output on my Solaris 9 machine:

Code:
$ cat file
<log logid="845b16ce190811052359400116">
<category>Upstream</category>
<operation>Delete</operation>
<target>SUB</target>
<instance></instance>
<user>sogadm</user>
<context>sog</context>
<fullOperation>DELETE:SUB:9371068317:PREPAY,1EST,ALL;</fullOperation>
<starttime>20081105235940.030937</starttime>
<stoptime>20081106000012.105544</stoptime>
<fullResult>RESP:940120105;;</fullResult>
<status>FAILED</status>
</log>


<log logid="845b16ce190811052359400116">
<category>Upstream</category>
<operation>Create</operation>
<target>SUB</target>
<instance></instance>
<user>sogadm</user>
<context>sog</context>
<fullOperation>CREATE:SUB:9371068317:PREPAY,1EST,ALL;</fullOperation>
<starttime>20081105235940.030937</starttime>
<stoptime>20081106000012.105544</stoptime>
<fullResult>RESP:0;</fullResult>
<status>SUCCESSFUL</status>
</log>


<log logid="845b16ce190811060000120118">
<category>Upstream.CAI</category>
<operation>Get</operation>
<target>CSUB</target>
<instance></instance>
<user>sogadm</user>
<context>sog</context>
<fullOperation>GET:CSUB:71068319:POSTPAY,1EST,ALL;</fullOperation>
<starttime>20081106000012.310898</starttime>
<stoptime>20081106000045.118912</stoptime>
<fullResult>RESP:0;</fullResult>
<status>SUCCESSFUL</status>
</log>
..
..
$ perl -00nle'
>   print join "\n", /<fullOperation>(.*?):.*<fullResult>(.*?);/s
>   ' file
DELETE
RESP:940120105

CREATE
RESP:0

GET
RESP:0

Are you sure your <log> tags are separated by empty lines?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK: How to extract text lines between two strings

Hi. I have a text test1.txt file like:Receipt Line1 Line2 Line3 End Receipt Line4 Line5 Line6 Canceled Receipt Line7 Line8 Line9 End (9 Replies)
Discussion started by: TQ3
9 Replies

2. Shell Programming and Scripting

Extract lines between 2 strings add white space

I'm trying to extract all the lines between 2 strings (including the lines containing the strings) To make the strings unique I need to include white space if possible. I'm not certain how to do that. sed -n '/ string1 /,/string2/p' infile > outfile & (4 Replies)
Discussion started by: dcfargo
4 Replies

3. Shell Programming and Scripting

Extract strings from multiple lines into one file -

input file Desired csv output gc_type, date/time, milli secs af, Mar 17 13:09:04 2011, 144.596 af, Mar 20 00:37:37 2011, 144.242 af, ar 20 21:30:59 2011, 108.518 Hi All, Any help in acheiving the above would be appreciated. I would like to parse through lines within one file and... (5 Replies)
Discussion started by: satish.vampire
5 Replies

4. Shell Programming and Scripting

Extract strings from multiple lines into one csv file

Hi all, Please go through my requirement. I have a log file in the location /opt/WebSphere61/AppServer/profiles/EMQbatchprofile/logs/EMQbatch This file contains the follwing pattern data <af type="tenured" id="42" timestamp="May 14 13:44:13 2011" intervalms="955.624"> <minimum... (8 Replies)
Discussion started by: satish.vampire
8 Replies

5. Shell Programming and Scripting

Compare one files with strings from another + remove lines

Have two files and want to compare the content of file1 with file2. When matched remove the line. awk 'NR==FNR {b; next} !(b in $0)' file1 file2file1 1. if match 2. removefile2 1. this line has to be removed if match 2. this line has a match, remove 3. this line has no match, no removingThe... (3 Replies)
Discussion started by: sdf
3 Replies

6. Shell Programming and Scripting

awk? extract quoted "" strings from multiple lines.

I am trying to extract multiple strings from snmp-mib files like below. ----- $ cat IF-MIB.mib <snip> linkDown NOTIFICATION-TYPE OBJECTS { ifIndex, ifAdminStatus, ifOperStatus } STATUS current DESCRIPTION "A linkDown trap signifies that the SNMP entity, acting in... (5 Replies)
Discussion started by: genzo
5 Replies

7. Shell Programming and Scripting

Finding a text in files & replacing it with unique strings

Hallo Everyone. I have to admit I'm shell scripting illiterate . I need to find certain strings in several text files and replace each of the string by unique & corresponding text. I prepared a csv file with 3 columns: <filename>;<old_pattern>;<new_pattern> ... (5 Replies)
Discussion started by: gordom
5 Replies

8. Shell Programming and Scripting

Concatenating 2 lines from 2 files having matching strings

Hello All Unix Users, I am still new to Unix, however I am eager to learn it.. I have 2 files, some lines have some matching substrings, I would like to concatenate these lines into one lines, leaving other untouched. Here below is an example for that.. File 1 (fasta file): >292183... (6 Replies)
Discussion started by: Mohamed EL Hadi
6 Replies

9. UNIX for Beginners Questions & Answers

How to extract the partial matching strings among two files?

I have a two file as shown below, file:1 >Contig_152_415 (REVERSE SENSE) >Contig_152_420 (REVERSE SENSE) >Contig_152_472 (REVERSE SENSE) >Contig_152_484 (REVERSE SENSE) File:2 >Contig_152:49081-49929 ATCGAGCAGCGCCGCGTGCGGTGCACCCTTGTGCAGATCGGGAGTAACCACGCGCACGGC... (2 Replies)
Discussion started by: dineshkumarsrk
2 Replies

10. UNIX for Beginners Questions & Answers

Match patterns between two files and extract certain range of strings

Hi, I need help to match patterns from between two different files and extract region of strings. inputfile1.fa >l-WR24-1:1 GCCGGCGTCGCGGTTGCTCGCGCTCTGGGCGCTGGCGGCTGTGGCTCTACCCGGCTCCGG GGCGGAGGGCGACGGCGGGTGGTGAGCGGCCCGGGAGGGGCCGGGCGGTGGGGTCACGTG... (4 Replies)
Discussion started by: bunny_merah19
4 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 08:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy