03-26-2008
Sequence number generation on a key column
Hi Folks,
Can you help me with this issue:
I have to generate the numbers say from 1001 for each record in a file based on a key field,
the catch is the generated number should be unique based on key column.
(EMP_NUMBER)
Example:
Input File:
EMP_NUMBER EMP_NAME
8908 SMITH
8100 DAVID
8100 DAVID
8230 MARK
8240 GEORGE
8100 DAVID
8100 DAVID
Output File:
8908 SMITH 1001
8100 DAVID 1002
8100 DAVID 1002
8230 MARK 1003
8240 GEORGE 1004
8100 DAVID 1005
8100 DAVID 1005
Thanks in advance.
S
10 More Discussions You Might Find Interesting
1. UNIX and Linux Applications
Hi,
I am using a remote storage service for backing up our data - we want to have a script run as part of a cron job which would do the backups from our local Linux machine to the service's Linux machine.
I want to use tar and ssh to do this (rather than mounting the disk and using cp) .... (5 Replies)
Discussion started by: same1290
5 Replies
2. Shell Programming and Scripting
I want to automate the process of generating RSA keys. I want to remotley login to a linux machine from a windows maching without having to enter a password. For this I need to generate the RSA key pair. but I want to do this procedure on alot of linux machines. For which I was looking to automate... (2 Replies)
Discussion started by: lassimanji
2 Replies
3. Shell Programming and Scripting
i have an xml tag. The value for the tag should be iterated through out the xml document.
eg:
<data><id><id><name>a</name><addr>aaa</addr><phnumb>3456</phnumb><state>ca</state><city>ny</city></data>... (6 Replies)
Discussion started by: Sgiri1
6 Replies
4. Shell Programming and Scripting
hi to all.
im a newbie in unix shell scripts. i want to make a simple unix shell script using the bash shell that asks a user to press any key after a series of commands, or an x if he wishes to exit. here's a sample script that i made:
#!/usr/bin/bash
pause(){
/usr/bin/echo "\t\t Press... (3 Replies)
Discussion started by: booghaw
3 Replies
5. Shell Programming and Scripting
Hi All,
I need a shell script which could insert a sequence number column inside a dat file(pipe delimited).
I have the dat file similar to the one as shown below..
|A|B|C||D|E
|F|G|H||I|J
|K|L|M||N|O
|P|Q|R||S|T
As shown above, the column 4 is currently blank and i need to insert sequence... (5 Replies)
Discussion started by: nithins007
5 Replies
6. Shell Programming and Scripting
Hi all,
I have a file like this
ID 3BP5L_HUMAN Reviewed; 393 AA.
AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3;
DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot.
DT 05-JUL-2004, sequence version 1.
DT 05-SEP-2012, entry version 71.
FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
What tool is used to generate public and private keys for SCP?
Do you have an example script that generates these keys, puts them in files and then another example script that references them from SCP?
Thanks, (9 Replies)
Discussion started by: Astrocloud
9 Replies
8. UNIX for Advanced & Expert Users
Hi All,
I have setup ssh keys for a user to transfer files without password between two hosts. But still the first time scp asks for confirmation and generates a key
Due to this our jobs are failing.
Is there a way I can avoid that first time key generation and confirmation also and automate... (3 Replies)
Discussion started by: baanprog
3 Replies
9. Shell Programming and Scripting
Hi,
I am using the nested for loops to generate the sequence ,
taking start and end sequence number input from test.txt
(sample content mentioned below).
Also , can I print the rest of columns as well with sequence number into the same file.
for i in `cat test.txt|cut -d"," -f7`
do ... (8 Replies)
Discussion started by: tushar.modgil
8 Replies
10. Shell Programming and Scripting
Hi All,
I have a file which has data like
a,b
c,d
e,f
g,h
And I need to insert a new column at the begining with sequence no( 1 to n)
1,a,b
2,c,d
3,e,f
4,g,h
Please let me know how to acheive this in unix (3 Replies)
Discussion started by: weknowd
3 Replies