exp command to extract particular rows


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers exp command to extract particular rows
# 1  
Old 06-18-2010
exp command to extract particular rows

Hi,

I'm new to unix so hopefully you can help!

I'm using the below command to extract a tables contents and store it in a dmp file:

exp OWNER/OWNER@LINK FILE=exp.dat TABLES=TABLE_TEST

This works fine and dumps the table into the exp.dat file.

What i can't figure out, is how to limit the data to only extract records for the last 5 days for example.

Supposing the table has a column called 'DATE' and the format of the timestamp is '01/JUNE/2010 00:00:00', what do i need to put so that i only extract data where the timestamp is greater than that date?

exp OWNER/OWNER@LINK FILE=exp.dat TABLES=TABLE_TEST WHERE DATE \> \'01\/JUNE\/2010 00\:00\:00\'

The above did not seem to work either.

Hope you can help!! Smilie

Moderator's Comments:
Mod Comment Use code tags instead of colors please, ty.

Last edited by zaxxon; 06-18-2010 at 08:49 AM.. Reason: code tags
# 2  
Old 06-18-2010
Query =

Hey !!
Try using
Code:
exp username/password@SID
file=
log=
tables=
query=

for example
if u have a table testtable with column testcolumn and value=1

then

Code:
exp user/pass@SID file=   log=   tables=testtable query=\"where testcolumn=1\"

for string comparison you can use : ( testcolumn = Ashish )

Code:
exp user/pass@SID file=   log=   tables=testtable query=\"where testcolumn=\'Ashish\'\"

\ is acting as the escape character for " and '

Cheeers !!

Last edited by Scott; 06-18-2010 at 09:05 AM.. Reason: Code tags, please...
# 3  
Old 06-18-2010
Thanks, that looks good, I'll try it out and let you know.

---------- Post updated at 04:03 PM ---------- Previous update was at 03:39 PM ----------

The code doesn't quite work. evrything is fine except this last bit:

Code:
QUERY=\"WHERE ADDED > '13/JUNE/2010 00:00:00'\"

do i need to escape all of the special charachters?

ADDED , the column name, is in caps and the date format is correct.

Thanks for your help with this.
# 4  
Old 06-19-2010
That did work once i escaped all of the other characters. Thanks again ashisharora.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract rows with different values at 2 columns

Hallo, I would need to extract only rows which has different value in the second and third column. Thank you very much for any advices Input: A 0 0 B 0 1 C 1 1 D 1 3 Output B 0 1 D 1 3 (4 Replies)
Discussion started by: kamcamonty
4 Replies

2. Shell Programming and Scripting

extract rows that have a specific name

Hi I want to extract rows in a large files that have a specific name. The name can be "starved and rich", "rich", "starved" or " ". Heres an example: bob starved and rich jack rich joey starved mike so it can have either 3 names or no name. I want to put the names into a... (4 Replies)
Discussion started by: phil_heath
4 Replies

3. Shell Programming and Scripting

Extract several columns with few rows

Hello, I want to extract several columns and rows from a huge tab delimited file for example: I want to print from from column 3 to 68 till row number 30. I have tried using cut command but it was extracting whole 3rd and 68th column. Please suggest a solution. Ryan (8 Replies)
Discussion started by: ryan9011
8 Replies

4. Shell Programming and Scripting

Extract fields from different rows.

Hi, I have data like below. SID=D6EB96CC0 HID=9C246D6 CSource=xya Cappe=1 Versionc=3670 MAR1=STL MARS2=STL REQ_BUFFER_ENCODING=UTF-8 REQ_BUFFER_ORIG_ENCODING=UTF-8 RESP_BODY_ENCODING=UTF-8 CON_ID=2713 I want to select CSource=xya (18 Replies)
Discussion started by: chetan.c
18 Replies

5. Shell Programming and Scripting

To extract selected rows

Hi, I have two files Input1.txt and Input2.txt and i need to have a output with selected lines starting with the values present in Input2.txt. For example: Input1.txt:... (5 Replies)
Discussion started by: bhas
5 Replies

6. UNIX for Dummies Questions & Answers

extract specific rows

Hi I have a file that looks like the one below. For the same 'TCONS' in the second column, I would like to extract the row that has the highest (or last) number in the fourth column. Any kind of help will be appreciated. input transcript_id "TCONS_00000051"; exon_number "1"; transcript_id... (4 Replies)
Discussion started by: jdhahbi
4 Replies

7. Shell Programming and Scripting

How to extract duplicate rows

Hi! I have a file as below: line1 line2 line2 line3 line3 line3 line4 line4 line4 line4 I would like to extract duplicate lines (not unique, triplicate or quadruplicate lines). Output will be as below: line2 line2 I would appreciate if anyone can help. Thanks. (4 Replies)
Discussion started by: chromatin
4 Replies

8. UNIX for Dummies Questions & Answers

extract a part of a path like (input: /etc/exp/home/bin ====> output: exp)

Hi, I need to make some extraction . with the following input to get the right output. input: /etc/exp/home/bin ====> output: exp and input: aex1234 ===> output: ex Thanks for your help, (4 Replies)
Discussion started by: yeclota
4 Replies

9. Shell Programming and Scripting

How to extract duplicate rows

I have searched the internet for duplicate row extracting. All I have seen is extracting good rows or eliminating duplicate rows. How do I extract duplicate rows from a flat file in unix. I'm using Korn shell on HP Unix. For.eg. FlatFile.txt ======== 123:456:678 123:456:678 123:456:876... (5 Replies)
Discussion started by: bobbygsk
5 Replies

10. Linux

Linux > Export (exp) command

Hi All, When I run the following command to export the data dump file: $ exp DEV@ccprod I get the following message: Export done in US7ASCII character set and AL16UTF16 NCHAR character set server uses WE8ISO8859P1 character set (possible charset conversion). The export works,... (2 Replies)
Discussion started by: ora_umair
2 Replies
Login or Register to Ask a Question