Sponsored Content
Top Forums Shell Programming and Scripting Managing sequence to make unique record Post 302368666 by gehlnar on Thursday 5th of November 2009 09:46:44 AM
Old 11-05-2009
Managing sequence to make unique record

Hi Everyone,

Using shell script i am getting final file as attached below. In this 4th column value should be unique using any sequence.
for instance I've 1_13020_SSGM which is appearing 6 times in file and i should change it like 1_13020_SSGM_1,1_13020_SSGM_2,....1_13020_SSGM_6.
Can someone please provide some idea on this?
Input file
05112009,601,Excel,1_13020_DWS,1,999001
05112009,601,Excel,1_11020_SSGM,1,999001
05112009,601,Excel,1_13020_SSGM,1,999001
05112009,601,Excel,1_13020_SSGM,1,999001
05112009,601,Excel,1_13020_SSGM,1,999001
05112009,601,Excel,1_13020_SSGM,1,999001
05112009,601,Excel,1_13020_SSGM,1,999001
05112009,601,Excel,1_13020_SSGM,1,999001
05112009,601,Excel,1_13020_NEWE,1,999001
05112009,601,Excel,1_13020_NEWE,1,999001
05112009,601,Excel,1_13020_NEWE,1,999001
05112009,601,Excel,1_13020_NEWE,1,999001
05112009,601,Excel,1_13020_NEWE,1,999001
05112009,601,Excel,1_11020_NEWE,1,999001
05112009,601,Excel,1_11020_DWS,1,999001
05112009,601,Excel,1_11020_DWS,1,999001
05112009,601,Excel,1_11020_DWS,1,999001
05112009,601,Excel,1_11020_DWS,1,999001
Output file
05112009,601,Excel,1_13020_DWS_1,1,999001
05112009,601,Excel,1_11020_SSGM_1,1,999001
05112009,601,Excel,1_13020_SSGM_1,1,999001
05112009,601,Excel,1_13020_SSGM_2,1,999001
05112009,601,Excel,1_13020_SSGM_3,1,999001
05112009,601,Excel,1_13020_SSGM_4,1,999001
05112009,601,Excel,1_13020_SSGM_5,1,999001
05112009,601,Excel,1_13020_SSGM_6,1,999001
05112009,601,Excel,1_13020_NEWE_1,1,999001
05112009,601,Excel,1_13020_NEWE_2,1,999001
05112009,601,Excel,1_13020_NEWE_3,1,999001
05112009,601,Excel,1_13020_NEWE_4,1,999001
05112009,601,Excel,1_13020_NEWE_5,1,999001
05112009,601,Excel,1_11020_NEWE_1,1,999001
05112009,601,Excel,1_11020_DWS_1,1,999001
05112009,601,Excel,1_11020_DWS_2,1,999001
05112009,601,Excel,1_11020_DWS_3,1,999001
05112009,601,Excel,1_11020_DWS_4,1,999001

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split a record ( in a row) and make it as new row

Hi All, The following is the scenario id name -------------- 1 William;Johnson 2 Azim;Abdul 3 Grasim . . etc.... I need the following output id name -------------- 1 William 1 Johnson 2 Azim (2 Replies)
Discussion started by: kottursamy
2 Replies

2. Shell Programming and Scripting

ksh scripting: Extract 1 most recent record for unique key

I'm loading multiple delimited files into an Oracle DB using sqlldr on Unix. I would like to get only the most recent record per each unique key. There may be multiple updates for each key, but I only want the most recent one. There is a date column in my delimited files, so I'm using cat to... (2 Replies)
Discussion started by: OPTIMUS_prime
2 Replies

3. Shell Programming and Scripting

Unique batch and sequence creation

Hi Everyone, I am working on Sun solaris. I would like to know that ,do we any way to create unique batch in shell scripts.Basically i want to create a batch and want to create a sequence to process the records. Regards, gehlnar (3 Replies)
Discussion started by: gehlnar
3 Replies

4. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

5. Shell Programming and Scripting

How to make delimited record ????

Can anyone suggest how to make delimited data for below report format Member Nbr Member Name Date Date Number Miles Rejected Reason Purge 1000000000 BROWNS N/B 10121998 01121998 377393930 500 INVALID CUSTOMER NUM issue is that my column name, data and between column i have variable... (7 Replies)
Discussion started by: ns64110
7 Replies

6. Shell Programming and Scripting

Grab unique record from different files on a condition

Hi, I think this is the toughest prob :wall: I have ever come across and I thankfully owe all of u for helping me cross this. cat 1.txt cat 2.txt K now. This is what I am looking for. Output.txt Here is how my output has been generated. First, the column one of each file... (6 Replies)
Discussion started by: jacobs.smith
6 Replies

7. Shell Programming and Scripting

Change unique file names into new unique filenames

I have 84 files with the following names splitseqs.1, spliseqs.2 etc. and I want to change the .number to a unique filename. E.g. change splitseqs.1 into splitseqs.7114_1#24 and change spliseqs.2 into splitseqs.7067_2#4 So all the current file names are unique, so are the new file names.... (1 Reply)
Discussion started by: avonm
1 Replies

8. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

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

9. Shell Programming and Scripting

Output first unique record in csv file

Hi, I have to output a new csv file from an input csv file with first unique value in the first column. input csv file color product id status green 102 pass yellow 201 hold yellow 202 keep green 101 ok green 103 hold yellow 203 ... (5 Replies)
Discussion started by: Chris LAU
5 Replies

10. Shell Programming and Scripting

CSV File:Filter duplicate records from column1 & another column having unique record

Hi Experts, I have csv file with 30, 40 columns Pasting just 2 column for problem description. Need to print error if below combination is not present in file check for column-1 (DocumentNumber) and filter columns where value in DocumentNumber field is same. For all such rows, the field... (7 Replies)
Discussion started by: as7951
7 Replies
ATF-SH(1)						    BSD General Commands Manual 						 ATF-SH(1)

NAME
atf-sh [-s shell] -- interpreter for shell-based test programs SYNOPSIS
atf-sh script DESCRIPTION
atf-sh is an interpreter that runs the test program given in script after loading the atf-sh(3) library. atf-sh is not a real interpreter though: it is just a wrapper around the system-wide shell defined by ATF_SHELL. atf-sh executes the inter- preter, loads the atf-sh(3) library and then runs the script. You must consider atf-sh to be a POSIX shell by default and thus should not use any non-standard extensions. The following options are available: -s shell Specifies the shell to use instead of the value provided by ATF_SHELL. ENVIRONMENT
ATF_LIBEXECDIR Overrides the builtin directory where atf-sh is located. Should not be overridden other than for testing purposes. ATF_PKGDATADIR Overrides the builtin directory where libatf-sh.subr is located. Should not be overridden other than for testing purposes. ATF_SHELL Path to the system shell to be used in the generated scripts. Scripts must not rely on this variable being set to select a specific interpreter. EXAMPLES
Scripts using atf-sh(3) should start with: #! /usr/bin/env atf-sh Alternatively, if you want to explicitly choose a shell interpreter, you cannot rely on env(1) to find atf-sh. Instead, you have to hardcode the path to atf-sh in the script and then use the -s option afterwards as a single parameter: #! /path/to/bin/atf-sh -s/bin/bash ENVIRONMENT
ATF_SHELL Path to the system shell to be used in the generated scripts. SEE ALSO
atf-sh(3) BSD
September 27, 2014 BSD
All times are GMT -4. The time now is 06:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy