11-06-2012
Quote:
Originally Posted by
xshang
Nice! Thank you! Can you explain the code in awk? I never saw that kind of code.
Sure. First of all, I'd made a mistake in my earlier script. Corrected now in my post.
It sorts the input file on the first field (delimited by commas) so that the duplicate records (w.r.t. the first field) are adjacent.
In the awk script, track is kept of the previous first field (p1) and record (p0). When p1 happens to be the same as the current first field, that's the start of a duplicate "bunch".
This User Gave Thanks to elixir_sinari For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have this scenario; where there are two classes:- apple and orange.
1,2,3,4,5,6,apple
1,1,0,4,2,3,apple
1,3,3,3,3,4,apple
1,1,1,1,1,1,orange
1,2,3,1,1,1,orange
Basically for apple, i have 3 entries in the file, and for orange, I have 2 entries. Im trying to edit the file and find... (5 Replies)
Discussion started by: ahjiefreak
5 Replies
2. Shell Programming and Scripting
Hi Guys,
I wanted to print the length of each record and the record itself.
I tried the following awk ...
awk 'a=length(); {print $a,$0}' file1
But it is giving me the records instead of length.
and also, it giving me each record twice. Means the value of a is not the length of the... (0 Replies)
Discussion started by: mac4rfree
0 Replies
3. UNIX Desktop Questions & Answers
Hello Experts !!!
Have some trouble finding a solution for the problem mentioned below.
Please help.
Thanks,
Lee.
I have set of input files as below
File1
MCMCNDD77 20100903:12:36:50 323-2322 BAC,MRP,NWER CKDJKJK838838 234 ... (4 Replies)
Discussion started by: OMLEELA
4 Replies
4. Shell Programming and Scripting
I have a dir as /library/utility/apache-tomcat/tbase-6001/repositories which has many huge directories and files. I am planning to replicate it to another folder
/library/utility/apache-tomcat/tbase2008-6001/repositories
Normal copy command is taking a hell lot of time and getting hung in... (1 Reply)
Discussion started by: Tuxidow
1 Replies
5. Shell Programming and Scripting
Hi all,
I have a file containing two fields with 154 rows/records/lines (forgive me, my UNIX terminology is not quite up to par yet). I am trying to read from this list, find a value (lets say 0), then print the record/line/row that value falls on (In this case it would be record/line/row #27)?... (5 Replies)
Discussion started by: StudentServitor
5 Replies
6. Shell Programming and Scripting
Is it possible to replicate the lines based on 4th column of the input like the below ?
input
ar1 10 100 -1
ar1 20 200 -2
arX 34 140 +1
arY 7 1 +4
output
ar1 10 100 -
ar1 20 200 -
ar1 20 200 -
arX 34 140 +
arY ... (1 Reply)
Discussion started by: quincyjones
1 Replies
7. UNIX for Advanced & Expert Users
actually i am trying to find the lenght of fixed width file record reading from teradata db but its not working can u guys help me out?
code which i wrote---
colmn_lngth=`cat $RPT_FILE | awk -F~ '{print $1}'`
rm $RPT_FILE
while read line
do
result=`echo $line | wc -m`
... (4 Replies)
Discussion started by: Seshendranath
4 Replies
8. Shell Programming and Scripting
Gents,
I needs to delete duplicate values and only get uniq values based in columns 2-27
Always we should keep the last record found...
I need to store one clean file and other with the duplicate values removed.
Input :
S3033.0 7305.01 0 420123.8... (18 Replies)
Discussion started by: jiam912
18 Replies
9. Shell Programming and Scripting
Hi! all
can any one tell me how to compare current record of column with next and previous record in awk without using array
my case is like this
input.txt
0 32
1 26
2 27
3 34
4 26
5 25
6 24
9 23
0 32
1 28
2 15
3 26
4 24 (7 Replies)
Discussion started by: Dona Clara
7 Replies
10. Shell Programming and Scripting
Hi All
My requirement is to find the null values in particular column of a file and reject it in case if it contains null values. But the challenge is that I want a common command which can be used across different file, as the position of the column we need to check for different file may get... (14 Replies)
Discussion started by: ginrkf
14 Replies
LEARN ABOUT DEBIAN
px_put_data_bytes
PX_PUT_DATA_BYTES(3) Library Functions Manual PX_PUT_DATA_BYTES(3)
NAME
PX_put_data_bytes -- Put value into a bytes data field
SYNOPSIS
#include <paradox.h>
void PX_put_data_bytes(pxdoc_t *pxdoc, char *data, int len, char *value)
DESCRIPTION
Simply copies a sequence of bytes into a data field as it stored in the database file. You should use this function instead of accessing
the record data directly.
data points to start of the data field in the record. It must be calculated by summing up all field length before the field to operate on
and add it to the base pointer of the record.
This function is similar to PX_put_data_alpha(3) without recoding. It is mostly used to store field data of Type pxfBytes.
SEE ALSO
PX_put_data_byte(3), PX_put_data_short(3), PX_put_data_long(3), PX_put_data_double(3), PX_put_data_alpha(3)
AUTHOR
This manual page was written by Uwe Steinmann uwe@steinmann.cx.
PX_PUT_DATA_BYTES(3)