How write the ignore dupkey command in UNIX?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How write the ignore dupkey command in UNIX?
# 1  
Old 06-13-2013
Code How write the ignore dupkey command in UNIX?

I know that in oracle the is a way to write to ignore the dupkey, something like

Code:
/*+ ignore_row_on_dupkey_index(tab, index_tab) */

Is there a way to do the same thing but with unix commands? I think there's a way with WHENEVER SQLERROR EXIT SQL.SQLCODE but i'm not sure and i don't know how do it. Thanks

ps: i mean records in the db. Ignore when there are the same record and go on.
# 2  
Old 06-13-2013
you can use uniq:

file1
Code:
1 2 3 4
1 2 3 4
1 2 3 3
9 9 9 3

## ignore first three columns
$ uniq file1 -f 3
1 2 3 4
1 2 3 3


Last edited by Scott; 06-13-2013 at 08:59 AM.. Reason: Please use code tags
# 3  
Old 06-13-2013
Quote:
Originally Posted by doganaym
you can use uniq:

file1
-----
1 2 3 4
1 2 3 4
1 2 3 3
9 9 9 3

## ignore first three columns
$ uniq file1 -f 3
1 2 3 4
1 2 3 3
I'm looking for SQL*Plus solution. The insert i'm going to do takes a file. This file has no duplicate rows. The problem is in the oracle. Not in the file. The recors could be duplicated.
# 4  
Old 06-13-2013
then this may help (distincts for col1 and col2):

Code:
select * from
(
select col1, col2, col3 ,row_number() over (partition by col1, col2 order by null) rn
from table1
) where rn=1;


Last edited by Scott; 06-13-2013 at 10:38 AM.. Reason: Code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX command to ignore replacing a search string if it is already present

Hello, I am searching the following string Folder^ in a file and replacing it with Folder^/ However if the file already contains Folder^/ I want to avoid replacing it with Folder^// To do this I have to do the following today: 1) echo "Folder^" | sed 's/Folder\^/Folder\^\//g' I get... (2 Replies)
Discussion started by: mehimadri12
2 Replies

2. Solaris

Solaris tar command to ignore mount points?

i.e. to stay in local filesytem. I believe the flag in linux is one-file-system. Is there corresponding in solaris? SOLARIS 9 BTW. (10 Replies)
Discussion started by: psychocandy
10 Replies

3. UNIX for Beginners Questions & Answers

How to ignore Case with in COMM command?

Hi, How can i ignore case between 2 files in unix using COMM command. 2 input files are: -bash-4.1$ more x2.txt HELLO hi HI raj -bash-4.1$ more x3.txt hello hi raj COMM command: -bash-4.1$ comm x2.txt x3.txt hello HELLO hi (3 Replies)
Discussion started by: raju2016
3 Replies

4. UNIX for Beginners Questions & Answers

Find command with Ignore Access issues

Hi, I am using following command to find a specific file. find . -name "find*.txt" -type f -print I am issuing that command at root directory since I don't know in which sub folder that file is getting created from some other process. As I am not having access to all directories, my... (3 Replies)
Discussion started by: RameshCh
3 Replies

5. Shell Programming and Scripting

Grep command to ignore line starting with hyphen

Hi, I want to read a file line by line and exclude the lines that are beginning with special characters. The below code is working fine except when the line starts with hyphen (-) in the file. for TEST in `cat $FILE | grep -E -v '#|/+' | awk '{FS=":"}NF > 0{print $1}'` do . . done How... (4 Replies)
Discussion started by: Srinraj Rao
4 Replies

6. Shell Programming and Scripting

How to ignore error in command in bash script?

Hello, i have bash script where im cycling some command for different lines in external file. example: while read domain;do nslookupout=$(nslookup -type=ns $domain) || true another commands done < filenamewithdomains i added: || true after the command in belief it will just skip... (6 Replies)
Discussion started by: postcd
6 Replies

7. Shell Programming and Scripting

Find command with ignore directory

Dear All, I am using find command find /my_rep/*/RKYPROOF/*/*/WDM/HOME_INT/PWD_DATA -name rk*myguidelines*.pdf -print The problem i am facing here is find /my_rep/*/ the directory after my_rep could be mice001, mice002 and mice001_PO, mice002_PO i want to ignore mice***_PO directory... (3 Replies)
Discussion started by: yadavricky
3 Replies

8. Shell Programming and Scripting

Ignore the 255 character limit of command line

Hi I would just like to ask if there is a way for UNIX to ignore/overcome the 255 character limit of the command line? My problem is that I have a really long line of text from a file (300+ bytes) which i have to "echo" and process by adding commands like "sed" to the end of the line, like... (5 Replies)
Discussion started by: agentgrecko
5 Replies

9. UNIX for Dummies Questions & Answers

How to ignore characters and print only number using unix?

say D45H E67H G779K F8888U T66Y Y333U output shud be like 45 67 779 8888 66 333 (5 Replies)
Discussion started by: cdfd123
5 Replies

10. UNIX for Dummies Questions & Answers

What can I ignore when backing up UNIX boxes?

Hi All, Long question and possibly a very short answer.... At work we've just got a new 3rd party backup solution (Netvault by Bakbone -it's v. nice), and I'm currently setting up my UNIX clients as part of the backup schedule. It's just occurred to me that there may be certain files or... (4 Replies)
Discussion started by: geralex
4 Replies
Login or Register to Ask a Question