Precisely Don. The file has already been sorted by the columns you mentioned. Sorting isn't really the issue here though. The issue is finding the median for all strings in col1 that share an ID, writing that answer for all lines that have that ID, and performing the same thing for a new string. I notice now the output example I gave is not very clear. It should look like this
Hi ,
I have a requirement to split the record based on particular match using UNIX.
Case1:
Input Record :
10.44.48.63;"Personals/Dating;sports";1441
Output Records :
10.44.48.63;Personals/Dating;1441;Original
10.44.48.63;sports;1441;Dummy
Case2:
Input Record : ... (5 Replies)
Hi All,
I have some data like below.
Step1,Param1,Param2,Param3
1,2,3,4
2,3,4,5
2,4,5,6
3,0,1,2
3,0,0,0
3,2,1,3
........
so on
Where I need to find the median(arithmetic) of each column from Param1...to..Param3 for each set of Step1 values.
(Sort each specific column, if the... (5 Replies)
I have input file like this
update tablename set column1='ABC',column2='BBC' where columnx=1 and columny=100 and columnz='10000001'
update tablename set column1='ABC',column2='BBC',column3='CBC' where columnx=1 and columny=100 and columnz='10000002'
update tablename set column1='ABC' where... (1 Reply)
Trying to match $2 in original_targets with $2 of new_targets . If the two numbers match exactly then a match.txt file is outputted using the information in the new_targets in the beginning 4 fields $1, $2, $3, $4 and value of $4 in the original_targets . If there is "No Match" then a no... (2 Replies)
Trying to match $1 of target.txt to $5 of file.txt. If there is a match then in an output.txt file $1,$1 (row underneath),$6,$4,$7 from file.txt are printed on the same line as $1 of target.txt. The input is from excel and the output should be tab-deliminated. Thank you :).
target.txt... (2 Replies)
I am trying to merge two lines to one based on some matching condition.
The file is as follows:
Matches filter:
'request ', timestamp, <HTTPFlow
request=<GET:
Matches filter:
'request ', timestamp, <HTTPFlow
request=<GET:
Matches filter:
'request ', timestamp, <HTTPFlow
... (8 Replies)
I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output.
$1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
Hi,
i have 2 files , the data i need to match is in masterfile and i need to pull out column 3 from master if column 1 and 2 match and output entire row to new file
I have tried with join and awk and i keep getting blank outputs or same file
is there an easier way than what i am... (4 Replies)
Discussion started by: axis88
4 Replies
LEARN ABOUT CENTOS
pcresample
PCRESAMPLE(3) Library Functions Manual PCRESAMPLE(3)NAME
PCRE - Perl-compatible regular expressions
PCRE SAMPLE PROGRAM
A simple, complete demonstration program, to get you started with using PCRE, is supplied in the file pcredemo.c in the PCRE distribution.
A listing of this program is given in the pcredemo documentation. If you do not have a copy of the PCRE distribution, you can save this
listing to re-create pcredemo.c.
The demonstration program, which uses the original PCRE 8-bit library, compiles the regular expression that is its first argument, and
matches it against the subject string in its second argument. No PCRE options are set, and default character tables are used. If matching
succeeds, the program outputs the portion of the subject that matched, together with the contents of any captured substrings.
If the -g option is given on the command line, the program then goes on to check for further matches of the same regular expression in the
same subject string. The logic is a little bit tricky because of the possibility of matching an empty string. Comments in the code explain
what is going on.
If PCRE is installed in the standard include and library directories for your operating system, you should be able to compile the demon-
stration program using this command:
gcc -o pcredemo pcredemo.c -lpcre
If PCRE is installed elsewhere, you may need to add additional options to the command line. For example, on a Unix-like system that has
PCRE installed in /usr/local, you can compile the demonstration program using a command like this:
gcc -o pcredemo -I/usr/local/include pcredemo.c
-L/usr/local/lib -lpcre
In a Windows environment, if you want to statically link the program against a non-dll pcre.a file, you must uncomment the line that
defines PCRE_STATIC before including pcre.h, because otherwise the pcre_malloc() and pcre_free() exported functions will be declared
__declspec(dllimport), with unwanted results.
Once you have compiled and linked the demonstration program, you can run simple tests like this:
./pcredemo 'cat|dog' 'the cat sat on the mat'
./pcredemo -g 'cat|dog' 'the dog sat on the cat'
Note that there is a much more comprehensive test program, called pcretest, which supports many more facilities for testing regular expres-
sions and both PCRE libraries. The pcredemo program is provided as a simple coding example.
If you try to run pcredemo when PCRE is not installed in the standard library directory, you may get an error like this on some operating
systems (e.g. Solaris):
ld.so.1: a.out: fatal: libpcre.so.0: open failed: No such file or directory
This is caused by the way shared library support works on those systems. You need to add
-R/usr/local/lib
(for example) to the compile command to get round this problem.
AUTHOR
Philip Hazel
University Computing Service
Cambridge CB2 3QH, England.
REVISION
Last updated: 10 January 2012
Copyright (c) 1997-2012 University of Cambridge.
PCRE 8.30 10 January 2012 PCRESAMPLE(3)