Extraction of data between parenthesis using multiple pattern

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Extraction of data between parenthesis using multiple pattern
# 1  
Old 02-21-2017
Extraction of data between parenthesis using multiple pattern

Code:
i want to extract all data with in parenthesis  from a file by passing a pattern from another file.i have some sql statements in my file and i want to extract those ddl by refering to a pattern which is in another file and before writting into file i need some transformation to do.Basically i want to do this in While/FOR loop

Pattern file:

ABC
XYZ

SRC FILE:

CREATE TABLE ABC
(
A,
B,
C
);

CREATE TABLE XYZ
(
X
);

SO NOW I WANT TO CHECK/PASS THE 1ST PATTERN AND IF MATCHES WHICH IS MATCHING IN SRC FILE THEN I WANT TO EXTRACT DATA WHICH ARE INSIDE PARENTHESIS.desired o/p below:
A,
B,
C

SAME WAY WHEN THE 2ND PATTERN WILL COME IT FOUND THE MATCHING IN SRC FILE AND OUTPUT WRITES IN TO OUTPUT FILE WHICH IS 

A

I WANT TO DO THIS IN LOOP(WHILE/FOR) IN ORDER TO MAKE SOME IN BETWEEN TRANSFORMATION BEFORE WRITING TO OUTPUT FILE.

HOPE THIS HELPS

# 2  
Old 02-21-2017
Registering with another member name after having been set to read only due to four forum rule infractions (after several more gentle reminders) won't fly. This thread is closed; user banned.
These 2 Users Gave Thanks to RudiC For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Script for extraction of pattern

Anyone can help here, with a script to extract the highlighted details from this two blocks?Actually there are milions of block, this is a sample? dn: EpsStaInfId=EpsStaInf,serv=EPS,mscId=aaaaaa001aaaaaaaa629100100138702,ou=multiSCs,dc=mtncg structuralObjectClass: EpsStaticInf objectClass:... (19 Replies)
Discussion started by: gillesi
19 Replies

2. Shell Programming and Scripting

Pattern Search and Extraction Problem

I have something like this: bash-3.2$ svn info Path: . URL: svn+ssh://nlaedev01@10.209.194.15/files0/nlae_dev_svn/repos/newlook-endeca/trunk Repository Root: svn+ssh://nlaedev01@10.209.194.15/files0/nlae_dev_svn/repos/newlook-endeca Repository UUID: 4e8fbe85-c2e2-42fe-a5fa-f9f9100d2393... (3 Replies)
Discussion started by: ankur328
3 Replies

3. Shell Programming and Scripting

Pattern extraction and usage by shell script

Suppose im in a directory A. which has sub-directories x/y/z m/n/p etc. Iam only considered with those which have a file netl.oa at the lowermost level. So i used the find command which gives me a list in the form ./abc/def/ghi/jkl/netl.oa and so on Now i want the names abc def jkl and ghi. My... (3 Replies)
Discussion started by: sid.verycool
3 Replies

4. UNIX for Dummies Questions & Answers

Need help for data extraction if files

Hello all, I want to extract some particular data from a files and than add all the values . but i m not able to cut the particular word(USU-INOCT and USU-OUTOCT) as it is coming not in column. and than able to add values coming in it . can anyone help me Please cat <file name> ... (7 Replies)
Discussion started by: anamdev
7 Replies

5. UNIX for Dummies Questions & Answers

Extraction of strings from a file, after pattern matching

I need to extract strings from a file. The file contains data like: Plan ABCD IN-+-172BB---118C2C---GGN_342-+-MM77_23--+-LAS24_3|GGK_774 | | \-LAS24_2|GGN_774 | +-AA_800_1-+-BAS_000|GGK_362 | | \-BAS_001|GGK_360 | \-DD_000T1---DAM_001|STEEL_0 Plan SHELL_1... (3 Replies)
Discussion started by: abkush
3 Replies

6. Shell Programming and Scripting

Extraction of data from multiple text files, and creation of a chart

Hello dear friends, My problem as explained below seems really basic. Fact is that I'm totally new to programming, and have only a week to produce a script ( CShell or Perl ? ) to perform this action. While searching on the forums, I found a command that could help me, but I don't know... (2 Replies)
Discussion started by: ackheron
2 Replies

7. Shell Programming and Scripting

parse data between parenthesis using shell script

Hi I am using shell script and i need to parse the data between parenthesis.How do i do it using shell script. Ex: section(name). I want to extract name from the above string using shell script. (4 Replies)
Discussion started by: julie_s
4 Replies

8. Shell Programming and Scripting

Data Extraction From a File

Hi All, I have a requirement where I have to search the file with some text say "Exception". This exception word can be repeated for more then 10 times. Suppose the "Exception" word is repeated at line numbers say x=10, 50, 60, 120. Now I want to extract all the lines starting from x-5 to... (3 Replies)
Discussion started by: rrangaraju
3 Replies

9. UNIX for Advanced & Expert Users

extraction of data from a text file which follows certain pattern

hi everybody, i have a file, in it I need to extract some data that follows a particular pattern.. For example: my file contains like now running Speak225 sep 22 mon 16:34:05 2008 -------------------------------- ... (4 Replies)
Discussion started by: mohkris
4 Replies

10. Shell Programming and Scripting

help with data extraction script

Hello all, Iam newbie here and to unix programming. I have the following text file. A:Woshington,B:London,C:Paris,D:Manchester,C:Lisbon,E:Cape town. Now I would like extract this and store in database. here is the script I have tried but it did work. CITY1:`echo "$text" | grep "A:"... (11 Replies)
Discussion started by: mam
11 Replies
Login or Register to Ask a Question