Sponsored Content
Top Forums Shell Programming and Scripting [Solved] Find and replace till nth occurence of a special character Post 302803139 by satyaatcgi on Monday 6th of May 2013 03:26:39 AM
Old 05-06-2013
[Solved] Find and replace till nth occurence of a special character

Hi,

I have a requirement to search for a pattern in each line in a file and remove the in between words till the 3rd occurrence of double quote (").

Ex: CREATE TABLE "SCHEMANAME"."AMS_LTV_STATUS"
(Note: "SCHEMANAME" may changes for different schemas. Its not a fixed value)

I need to remove whatever value comes starting from TABLE till the 3rd occurrence of "

The output should be:
CREATE TABLE "AMS_LTV_STATUS"

Thanks in Advance.

Cheers
SatyaSmilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Replace nth character in a file with a period

Hi all, If you look at the example below,I want to replace the 21st character (,) with a period (.). I have 1000 records in a file can someone help me how to do that. Thankyou all in advance. "2008-07-15... (3 Replies)
Discussion started by: blackhawk_123
3 Replies

2. Shell Programming and Scripting

Find index of last occurence of a character within a string

I need to find the index of last '|' (highlighted in bold) in awk : |ifOraDatabase.Lastservererr<>0then|iferr_flag<>0then|end if Please suggest a way... Thanks (5 Replies)
Discussion started by: joyan321
5 Replies

3. Shell Programming and Scripting

Replace matching nth occurence

Hi for eg my file has: val1 | val2 | val1 | val2 | val1 | val2 | val1 | val2 | here i need to replace '|' with '|\n' where the occurence of '|' is divisble by 2 so that the output comes like this val1 | val2 | val1 | val2 | val1 | val2 | val1 | val2 | Requesting suggestions in... (1 Reply)
Discussion started by: raghav288
1 Replies

4. UNIX for Dummies Questions & Answers

To find the Nth Occurence of Search String

Hi guys, I like to find the Line number of Nth Occurence of a Search string in a file. If possible, if it will land the cursor to that particualar line will be great. Cheers!! (3 Replies)
Discussion started by: mac4rfree
3 Replies

5. Emergency UNIX and Linux Support

Replace nth position character of all the lines in file

I want to replace 150th character of all the lines in a file using sed or awk... searched the forums but didn't find exact answer (9 Replies)
Discussion started by: greenworld123
9 Replies

6. Shell Programming and Scripting

replace /n with special character

I would like to replace /n with ',' and after replace remove last semicolon then put a open brace in starting and closing brace in end of line. See below example: input: 1234 3455 24334 234 output: ('1234,'3455',24334','234') Thanks (3 Replies)
Discussion started by: anupdas
3 Replies

7. Shell Programming and Scripting

To find nth position of character in string

Hi guyz i want to know nth position of character in string. For ex. var="UK,TK,HK,IND,AUS" now if we see 1st occurance of , is at 3 position, 2nd at 6,..4th at 13 position. 1st position we can find through INDEX, but what about 2nd,3rd and 4th or may be upto nth position. ? In oracle we had... (2 Replies)
Discussion started by: Jonty Immortal
2 Replies

8. Shell Programming and Scripting

awk script to replace nth character with comma

I have a requirement as below. In one of my column, I have data which may or may not be separted with coma always. Now I need to validate the length of these text within the coma (if available) and if the length is more than 30 characters, I need to insert a coma either at 30 characters if its... (3 Replies)
Discussion started by: aramacha
3 Replies

9. Shell Programming and Scripting

awk - find first occurence and replace it

Hello, I have a requirement to replace the whole string with first occurence of value of a key-value pair. I have to do this inside awk, as the data I need to work is inside an awk loop. value of my variable(say LogText) looks like: LogText= date=04Mar message=hello1 name=caq... (4 Replies)
Discussion started by: cool.aquarian
4 Replies

10. Shell Programming and Scripting

Replace nth to nth character?

Hi I got the following problem and I wonder if some could please help me out? I'd like to replace character 8 - 16 , 16 - 24 cat file ... (2 Replies)
Discussion started by: stinkefisch
2 Replies
Vend::Accounting::SQL_Ledger(3pm)			User Contributed Perl Documentation			 Vend::Accounting::SQL_Ledger(3pm)

   parts table
       CREATE TABLE "parts" (	   "id" integer DEFAULT nextval('id'::text),	  "partnumber" text,	  "description" text,	   "bin" text,
	    "unit" character varying(5),      "listprice" double precision,	 "sellprice" double precision,	    "lastcost" double precision,
	    "priceupdate" date DEFAULT date('now'::text),      "weight" real,	   "onhand" real DEFAULT 0,	 "notes" text,	    "makemodel"
       boolean DEFAULT 'f',	 "assembly" boolean DEFAULT 'f',      "alternate" boolean DEFAULT 'f',	    "rop" real,      "inventory_accno_id"
       integer,      "income_accno_id" integer,      "expense_accno_id" integer,      "obsolete" boolean DEFAULT 'f' );

   oe table
       CREATE TABLE "oe" (	"id" integer DEFAULT nextval('id'::text),      "ordnumber" text,      "transdate" date DEFAULT date('now'::text),
	    "vendor_id" integer,      "customer_id" integer,	  "amount" double precision,	  "netamount" double precision,      "reqdate"
       date,	  "taxincluded" boolean,      "shippingpoint" text,	 "notes" text,	    "curr" character(3) );

NAME
Vend::Accounting::SQL-Ledger - SQL-Ledger Accounting Interface for Interchange DESCRIPTION
This module is an attempt to create a set of callable routines that will allow the easy integration of the SQL-Ledger Accounting package with Interchange. It handles the mapping of the Interchange variable names to the appropriate SQL-Ledger ones as well as parsing the html returned by the SQL-Ledger "API". Background: SQL-Ledger Accounting "www.sql-ledger.org" is a multiuser, double entry, accounting system written in Perl and is licensed under the GNU General Public License. The SQL-Ledger API: SQL-Ledger functions can be accessed from the command line by passing all the variables in one long string to the perl script. The variable=value pairs must be separated by an ampersand. See "www.sql-ledger.org/misc/api.html" for more details on the command line interface. ------------------------------------------------------------------ This module also happens to be the author's first perl module and probably his second or third perl program in addition to "Hello World". :) So please go easy on me. -Daniel Schema CREATE SEQUENCE "id" start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; CREATE TABLE "makemodel" ( "id" integer, "parts_id" integer, "name" text ); CREATE TABLE "gl" ( "id" integer DEFAULT nextval('id'::text), "source" text, "description" text, "transdate" date DEFAULT date('now'::text) ); CREATE TABLE "chart" ( "id" integer DEFAULT nextval('id'::text), "accno" integer, "description" text, "charttype" character(1) DEFAULT 'A', "gifi" integer, "category" character(1), "link" text ); CREATE TABLE "defaults" ( "inventory_accno_id" integer, "income_accno_id" integer, "expense_accno_id" integer, "fxgain_accno_id" integer, "fxloss_accno_id" integer, "invnumber" text, "ordnumber" text, "yearend" character varying(5), "curr" text, "weightunit" character varying(5), "businessnumber" text, "version" character varying(8) ); CREATE TABLE "acc_trans" ( "trans_id" integer, "chart_id" integer, "amount" double precision, "transdate" date DEFAULT date('now'::text), "source" text, "cleared" boolean DEFAULT 'f', "fx_transaction" boolean DEFAULT 'f' ); CREATE TABLE "invoice" ( "id" integer DEFAULT nextval('id'::text), "trans_id" integer, "parts_id" integer, "description" text, "qty" real, "allocated" real, "sellprice" double precision, "fxsellprice" double precision, "discount" real, "assemblyitem" boolean DEFAULT 'f' ); CREATE TABLE "vendor" ( "id" integer DEFAULT nextval('id'::text), "name" character varying(35), "addr1" character varying(35), "addr2" character varying(35), "addr3" character varying(35), "addr4" character varying(35), "contact" character varying(35), "phone" character varying(20), "fax" character varying(20), "email" text, "notes" text, "terms" smallint DEFAULT 0, "taxincluded" boolean ); CREATE TABLE "customer" ( "id" integer DEFAULT nextval('id'::text), "name" character varying(35), "addr1" character varying(35), "addr2" character varying(35), "addr3" character varying(35), "addr4" character varying(35), "contact" character varying(35), "phone" character varying(20), "fax" character varying(20), "email" text, "notes" text, "discount" real, "taxincluded" boolean, "creditlimit" double precision DEFAULT 0, "terms" smallint DEFAULT 0, "shiptoname" character varying(35), "shiptoaddr1" character varying(35), "shiptoaddr2" character varying(35), "shiptoaddr3" character varying(35), "shiptoaddr4" character varying(35), "shiptocontact" character varying(20), "shiptophone" character varying(20), "shiptofax" character varying(20), "shiptoemail" text ); CREATE TABLE "parts" ( "id" integer DEFAULT nextval('id'::text), "partnumber" text, "description" text, "bin" text, "unit" character varying(5), "listprice" double precision, "sellprice" double precision, "lastcost" double precision, "priceupdate" date DEFAULT date('now'::text), "weight" real, "onhand" real DEFAULT 0, "notes" text, "makemodel" boolean DEFAULT 'f', "assembly" boolean DEFAULT 'f', "alternate" boolean DEFAULT 'f', "rop" real, "inventory_accno_id" integer, "income_accno_id" integer, "expense_accno_id" integer, "obsolete" boolean DEFAULT 'f' ); CREATE TABLE "assembly" ( "id" integer, "parts_id" integer, "qty" double precision ); CREATE TABLE "ar" ( "id" integer DEFAULT nextval('id'::text), "invnumber" text, "ordnumber" text, "transdate" date DEFAULT date('now'::text), "customer_id" integer, "taxincluded" boolean, "amount" double precision, "netamount" double precision, "paid" double precision, "datepaid" date, "duedate" date, "invoice" boolean DEFAULT 'f', "shippingpoint" text, "terms" smallint DEFAULT 0, "notes" text, "curr" character(3) ); CREATE TABLE "ap" ( "id" integer DEFAULT nextval('id'::text), "invnumber" text, "transdate" date DEFAULT date('now'::text), "vendor_id" integer, "taxincluded" boolean, "amount" double precision, "netamount" double precision, "paid" double precision, "datepaid" date, "duedate" date, "invoice" boolean DEFAULT 'f', "ordnumber" text, "curr" character(3) ); CREATE TABLE "partstax" ( "parts_id" integer, "chart_id" integer ); CREATE TABLE "tax" ( "chart_id" integer, "rate" double precision, "taxnumber" text ); CREATE TABLE "customertax" ( "customer_id" integer, "chart_id" integer ); CREATE TABLE "vendortax" ( "vendor_id" integer, "chart_id" integer ); CREATE TABLE "oe" ( "id" integer DEFAULT nextval('id'::text), "ordnumber" text, "transdate" date DEFAULT date('now'::text), "vendor_id" integer, "customer_id" integer, "amount" double precision, "netamount" double precision, "reqdate" date, "taxincluded" boolean, "shippingpoint" text, "notes" text, "curr" character(3) ); CREATE TABLE "orderitems" ( "trans_id" integer, "parts_id" integer, "description" text, "qty" real, "sellprice" double precision, "discount" real ); CREATE TABLE "exchangerate" ( "curr" character(3), "transdate" date, "buy" double precision, "sell" double precision ); perl v5.14.2 2011-03-09 Vend::Accounting::SQL_Ledger(3pm)
All times are GMT -4. The time now is 11:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy