The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Some questions - renaming duplicate names kylle345 UNIX for Dummies Questions & Answers 1 05-08-2009 07:29 PM
wh inode index starts from 1 unlike array index (0) sairamdevotee UNIX for Dummies Questions & Answers 1 08-17-2008 05:04 AM
why the inode index of file system starts from 1 unlike array index(0) sairamdevotee Filesystems, Disks and Memory 0 08-17-2008 04:50 AM
Bash Script duplicate file names stumpyuk Shell Programming and Scripting 6 07-11-2007 05:43 PM
What is index? ravi raj kumar Shell Programming and Scripting 3 12-26-2006 08:43 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-11-2009
sotoc79 sotoc79 is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 1
Wink duplicate index names renamed

Hello everyone !

Please have a minute and see if you know how to script this

I have a file like this:


"create table ....
...
create index n112 on ...
...
create table ...
....
create index n113 on...

...
create table ...
create index n112 on ...! duplicate
...

and so on ...

Can one make a script to find the duplicate index names and automatically rename them like n112kk0, n112kk1, n112kk2 ...etc ?

Thank you very much !
  #2 (permalink)  
Old 06-11-2009
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131

Code:
nawk '/^create index/ {if ($3 in dup)$3=$3 "kk" ++dup[$3];else dup[$3]}1' myFile

Reply

Bookmarks

Tags
duplicates rename

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0