Sponsored Content
Top Forums Shell Programming and Scripting duplicate index names renamed Post 302324653 by vgersh99 on Thursday 11th of June 2009 09:59:20 AM
Old 06-11-2009
Code:
nawk '/^create index/ {if ($3 in dup)$3=$3 "kk" ++dup[$3];else dup[$3]}1' myFile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash Script duplicate file names

I am trying to write a housekeeping bash script. Part of it involves searching all of my attached storage media for photographs and moving them into a single directory. The problem occurs when files have duplicate names, obviously a file called 001.jpg will get overwritten with another file... (6 Replies)
Discussion started by: stumpyuk
6 Replies

2. Filesystems, Disks and Memory

why the inode index of file system starts from 1 unlike array index(0)

why do inode indices starts from 1 unlike array indexes which starts from 0 its a question from "the design of unix operating system" of maurice j bach id be glad if i get to know the answer quickly :) (0 Replies)
Discussion started by: sairamdevotee
0 Replies

3. UNIX for Dummies Questions & Answers

wh inode index starts from 1 unlike array index (0)

brothers why inode index starts from 1 unlike array inex which starts from 0 its a question from the design of unix operating system of maurice j.bach i need to know the answer urgently...someone help please (1 Reply)
Discussion started by: sairamdevotee
1 Replies

4. UNIX for Dummies Questions & Answers

Some questions - renaming duplicate names

I have a file that looks like this 2 4 10 500 tim9 5 8 14 700 tim9 3 5 15 432 john1 1 4 12 999 ellen2 So basically what i want to do is fine duplicate names on column 5 and rename it with an extention (i.e. tim9_1 and tim9_2). so the output file will look like this 2 4 10 500 tim9_1... (1 Reply)
Discussion started by: kylle345
1 Replies

5. Shell Programming and Scripting

Sort from start index and end index in line

Hi All, I have a file (FileNames.txt) which contains the following data in it. $ cat FileNames.txt MYFILE17XXX208Sep191307.csv MYFILE19XXX208Sep192124.csv MYFILE20XXX208Sep192418.csv MYFILE22XXX208Sep193234.csv MYFILE21XXX208Sep193018.csv MYFILE24XXX208Sep194053.csv... (5 Replies)
Discussion started by: krish_indus
5 Replies

6. Shell Programming and Scripting

Find the number of non-duplicate names recursively.

Hi, here comes another newbie question: How to find the number of non-duplicate names recursively? For example, my files are stored in the folders like: If I do find . -depth -name "*.txt" | wc -l This will gives out a result "4". One .txt file named "1.txt" in folder "1", and... (2 Replies)
Discussion started by: jiapei100
2 Replies

7. Shell Programming and Scripting

Using awk to append incremental numbers to the end of duplicate file names.

I'm currently working on a script that extracts files from a .zip, runs an sha1sum against them and then uses awk to pre-format them into zomething more readable thusly: Z 69 89e013b0d8aa2f9a79fcec4f2d71c6a469222c07 File1 Z 69 6c3aea28ce22b495e68e022a1578204a9de908ed File2 Z 69... (5 Replies)
Discussion started by: Ethereal
5 Replies

8. Shell Programming and Scripting

who renamed my executable

Hi All, I connected via rlogin in testing environment (ksh ) and placed an executable with -rwxr-xr-x permission. eg: from my own unix box used : rlogin host -l user But the exe was renamed by somebody. since it's only renaming none of the access time , modification time etc is altered.... (2 Replies)
Discussion started by: blackcat
2 Replies

9. Shell Programming and Scripting

Duplicate value with different index

Hello Gents, Please give a help with this case Input 10001010G1 10001010G1 10001010G1 10001010G2 10001010G3 10001012G1 10001012G1 10001012G1 10001012G1 10001014G1 10001014G1 10001014G2 (5 Replies)
Discussion started by: jiam912
5 Replies

10. Shell Programming and Scripting

Adding sequential index to duplicate strings

I have a text file in the following format >Homo sapiens KQKCLYNLPFKRNLEGCRERCSLVIQIPRCCKGYFGRDCQACPGGPDAPCNNRGVCLDQY SATGECKCNTGFNGTACEMCWPGRFGPDCLPCGCSDHGQCDDGITGSGQCLCETGWTGPS CDTQAVLPAVCTPPCSAHATCKENNTCECNLDYEGDGITCTVVDFCKQDNGGCAKVARCS... (2 Replies)
Discussion started by: jerrild
2 Replies
dup(2)								System Calls Manual							    dup(2)

Name
       dup, dup2 - duplicate an open file descriptor

Syntax
       newd = dup(oldd)
       int newd, oldd;

       dup2(oldd, newd)
       int oldd, newd;

Description
       The  system  call  duplicates  an  existing  object descriptor.	The argument oldd is a small non-negative integer index in the per-process
       descriptor table.  The value must be less than the size of the table, which is returned by The new descriptor, newd, returned by  the  call
       is the lowest numbered descriptor that is not currently in use by the process.

       The object referenced by the descriptor does not distinguish between references using oldd and newd in any way.	Thus, if newd and oldd are
       duplicate references to an open file, and calls all move a single pointer into the file.  If a separate pointer into the file is desired, a
       different object reference to the file must be obtained by issuing an additional call.

       In the second form of the call, specify the value of newd needed. If this descriptor is already in use, the descriptor is first deallocated
       as if a call had been done.

Return Values
       The value -1 is returned if an error occurs in either call.  The external variable errno indicates the cause of the error.

Diagnostics
       The and system calls fail under the following conditions:

       [EBADF]	      The oldd or newd is not a valid active descriptor.

       [EMFILE]       Too many descriptors are active.

       [EINTR]	      The or function was terminated prematurely by a signal.

See Also
       accept(2), close(2), getdtablesize(2), lseek(2), open(2), pipe(2), read(2), socket(2), socketpair(2), write(2)

																	    dup(2)
All times are GMT -4. The time now is 08:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy