awk script to append suffix to column when column has duplicated values
Please help me to get required output for both scenario 1 and scenario 2 and need separate code for both scenario 1 and scenario 2
Scenario 1
i need to do below changes only when column1 is CR and column3 has duplicates rows/values. This inputfile can contain 100 of this duplicated rows of column3 Value in column 3 to be suffixe with sequence starting from "a" followed by CR.
if we have appended suffix till a to z with CR like(aCR, bCR, cCR till zCR), then next suffix will be aaCR, abCR, acCR ans so on for column3
Input File
Output File
Scenario 2 Required separate code for this scenario Below is for different file i need to do below changes only when column1 is DR and column3 has duplicates rows/values.
Value in column 3 to be suffixe with sequence starting from "a" except for first document followed by DR.
if we have appended suffix till a to z with DR like(aDR, bDR, cDR till zDR), then next suffix will be aaDR, abDR, acDR ans so on for column3
Input File
output file
a||c
I tried below code, it is giving me output for scenario 2 but not able to append sequence number to column3. I am able to suffix only "a" which is static. Here need to consider column1 equal to CR for scenario 1 and DR for scenario2 as well(that im unable to do)
Code output :
Please help me to get required output for both scenario 1 and scenario 2 and need separate code for both scenario 1 and scenario 2
Example:
I have files in below format
file 1:
zxc,133,joe@example.com
cst,222,xyz@example1.com
File 2 Contains:
hxd
hcd
jws
zxc
cst
File 1 has 50000 lines and file 2 has around 30000 lines :
Expected Output has to be :
hxd
hcd
jws (5 Replies)
Hi Experts,
Please bear with me, i need help
I am learning AWk and stuck up in one issue.
First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique.
Second point : For... (1 Reply)
I'm trying to make an awk script to compare values I've set as var1, var2, and var3 earlier in the script to the values in the userinputted column of four text files called Node1.txt, Node2.txt, Node3.txt, and Node4.txt and then replace the values in that userinputted column with either ttt or gcc,... (8 Replies)
Hi,
I have the following output from an Oracle SQL statement and I want to remove duplicated column values.
I know it is possible using Oracle analytical/statistical functions but unfortunately I don't know how to use any of those.
So now, I've gone to PLAN B using awk/sed maybe or any... (5 Replies)
Hi,
I need help to match two files based on two columns.
file_1
ID AA An Ca Ele Pro Su Ot Tra
g13950 No No Yes No Yes Yes Yes Yes
g05760 Yes No No No No Yes Yes Yes
g12640 No No No No No No No No
k17720 No Yes No No No No No Yes
g05640 Yes Yes Yes No No Yes Yes Yes
file_2
... (8 Replies)
Hi,
My input files is like this
axis1 0 1 10
axis2 0 1 5
axis1 1 2 -4
axis2 2 3 -3
axis1 3 4 5
axis2 3 4 -1
axis1 4 5 -6
axis2 4 5 1
Now, these are my following tasks
1. Print a first column for every two rows that has the same value followed by a string.
2. Match on the... (3 Replies)
Hi! Is there a way to append column and row header to a file in awk script.
For example if I have
Jane F 39 manager
Carlos M 40 system administrator
Sam F 20 programmer
and I want it to be
# name gend age occup
1 Jane F 39 manager
2 Carlos M ... (4 Replies)
Hi,
I need an awk script (or whatever shell-construct) that would take data like below and get the max value of 3 column, when grouping by the 1st column.
clientname,day-of-month,max-users
-----------------------------------
client1,20120610,5
client2,20120610,2
client3,20120610,7... (3 Replies)
Hello,
I have 2 columns (1st column has multiple entries but the corresponding values in the column 2 may be the same or different.) however I want to extract unique values for each entry in column 1 by assigning the max value from column 2
SDF4 -0.211654
SDF4 0.978068
... (1 Reply)