|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Emergency UNIX and Linux Support !! Help Me!! Post your urgent questions here for highest visibility. Posting a new thread to this forum requires Bits. We monitor this forum to help people with emergencies, but we do not guarantee response time or answers. This forum is "best effort" only. Members who reply to posts here receive a bonus of 1000 Bits per reply. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#15
|
|||
|
|||
|
Code:
#!/usr/bin/awk
BEGIN {
col3[""]=0;
col4[""]=0;
}
{
if(col3[$3] <= 0){
col3[$3] = 1;
data3 = $3;
}
else {
col3[$3]++;
data3 = ($3-0.1*(col3[$3]-1));
}
if(col4[$4] <= 0) {
col4[$4] = 1;
data4 = $4;
}
else {
col4[$4]++;
data4 = ($4-0.1*(col4[$4]-1));
}
print $1 $2 data3 data4;
}This is not tested.. |
| Sponsored Links | ||
|
|
|
#16
|
||||
|
||||
|
another approach:- Code:
nawk 'a[$3$4]++ { $3 -= 0.1}1' testbut kindly radoulov in your solution Code:
awk '($3 -= 0.1 * c[$3,$4]++)||1' infile why you used multiplication instead of Code:
awk '($3 -= 0.1 && c[$3,$4]++)||1' infile |
|
#17
|
||||
|
||||
|
aaiaz:- using multiplication and not && is for the subtraction value (amount) that we have to subtract after pattern repetition so you have to use "*" not "&&" by the way ...you code will not work proparly because each time you subtract "0.1" although in the second pattern you have to subtract "0.2". BR ![]() ![]() ![]() |
|
#18
|
||||
|
||||
|
Thanks man for the details ...I had understand now.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extract data based on match against one column data from a long list data | patrick87 | Shell Programming and Scripting | 12 | 11-17-2009 03:27 AM |
| Linear data to column data..script help seeked | ak835 | Shell Programming and Scripting | 1 | 09-02-2009 01:32 PM |
| How to check Null values in a file column by column if columns are Not NULLs | Mandab | Shell Programming and Scripting | 7 | 03-15-2008 08:57 AM |
| check column | ust | Shell Programming and Scripting | 1 | 01-24-2008 06:43 AM |
| How to check a column contain numeric or char data type ?? | jambesh | Shell Programming and Scripting | 12 | 10-06-2006 10:37 AM |