Sponsored Content
Full Discussion: Join Function in PERL
Top Forums Shell Programming and Scripting Join Function in PERL Post 302427314 by durden_tyler on Friday 4th of June 2010 02:57:17 PM
Old 06-04-2010
Quote:
Originally Posted by thankful123
Its printing in a same line, all the file, the joining is not breaked if found date stamp.

2009-11-10 04:49:16,170 INFO handlers
b;
c;
ddaa;

2009-11-10 04:49:16,170 INFO handlers
aa;
bb;
cc;

OUTPUT:

2009-11-10 04:49:16,170 INFO handlers b; c; ddaa;
2009-11-10 04:49:16,170 INFO handlers aa; bb; cc;

...
Something like this maybe ?

Code:
$
$
$ cat f1
2009-11-10 04:49:16,170 INFO handlers
b;
c;
ddaa;

2009-11-10 04:49:16,170 INFO handlers
aa;
bb;
cc;
$
$
$ perl -ne 'chomp; if (/^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d,.*$/ or /./){print $_," "} else {print "\n"} END {print "\n"}' f1
2009-11-10 04:49:16,170 INFO handlers b; c; ddaa;
2009-11-10 04:49:16,170 INFO handlers aa; bb; cc;
$
$

tyler_durden
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

join function and -o and -a

I'm completing a join where I specify the outfile format....such as: join -t \| -j1 1 -j2 1 -o 1.1 1.2 1.3 2.4 1.5 1.6 1.7 $OUTFILE TMP_INFILE > NEW_OUTFILE Now this works great. Now what I also want is to include any unmatched rows from the first file...and I use the -a flag for this. ... (1 Reply)
Discussion started by: peter.herlihy
1 Replies

2. Shell Programming and Scripting

join 2 array in perl?

Hi guys, Can anyone tell me how to join 2 array together? @array1=("abc", "def"); @array2=("xyz", "uuu"); @join_array = fun(@array1,@array2); # @join_array == ("abc", "def", "xyz", "uuu") any function can do what fun(@@) does? thanks Gusla (2 Replies)
Discussion started by: gusla
2 Replies

3. Shell Programming and Scripting

oct function in perl

hi i came across one program which uses some method to calculate file permissions using lstat in perl and i am not getting how its doing that i am pasting the code below ... $ > cat b.pl use Fcntl':mode'; my... (0 Replies)
Discussion started by: zedex
0 Replies

4. Programming

sql,multiple join,outer join issue

example sql: select a.a1,b.b1,c.c1,d.d1,e.e1 from a left outer join b on a.x=b.x left outer join c on b.y=c.y left outer join d on d.z=a.z inner join a.t=e.t I know how single outer or inner join works in sql. But I don't really understand when there are multiple of them. can... (0 Replies)
Discussion started by: robbiezr
0 Replies

5. UNIX for Dummies Questions & Answers

Join 2 files with multiple columns: awk/grep/join?

Hello, My apologies if this has been posted elsewhere, I have had a look at several threads but I am still confused how to use these functions. I have two files, each with 5 columns: File A: (tab-delimited) PDB CHAIN Start End Fragment 1avq A 171 176 awyfan 1avq A 172 177 wyfany 1c7k A 2 7... (3 Replies)
Discussion started by: InfoSeeker
3 Replies

6. Shell Programming and Scripting

Function extraction in PERL

the log contains mathematical operation as follows fm_void_mathematics : PCM_OP_MATHS input function PIN_FLD_NUM1 INT 1 PIN_FLD_NUM2 INT 2 PIN_FLD_RESULTS int PIN_FLD_OUT INT * D Wed Sep 16 05:40:22 2009 solaris_testing fm_void_add : PIN_FLD_SUM int 3 D Wed Sep 16 05:40:22 2009... (1 Reply)
Discussion started by: vkca
1 Replies

7. Shell Programming and Scripting

Perl split and join

Hi, I have tried the split and join functions but stuck with unexpected results. Any help appreciated. I pass multiple values at command line like perl test.pl -type java,xml. This works good for me but i am not sure how to print it in the required format. Here is the code i tried:... (4 Replies)
Discussion started by: nmattam
4 Replies

8. UNIX for Dummies Questions & Answers

How to use the the join command to join multiple files by a common column

Hi, I have 20 tab delimited text files that have a common column (column 1). The files are named GSM1.txt through GSM20.txt. Each file has 3 columns (2 other columns in addition to the first common column). I want to write a script to join the files by the first common column so that in the... (5 Replies)
Discussion started by: evelibertine
5 Replies

9. Shell Programming and Scripting

Problem of Perl's "join" function

$ perl -e '@f=("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","1","911"); print join("\t",@f)."\n";' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ... (5 Replies)
Discussion started by: carloszhang
5 Replies

10. Shell Programming and Scripting

Converting shell to Perl I run into shell built in function trap and need alternative in Perl

I am working on converting shell to Perl script. In shell we have built in function trap Do you know alternative in Perl or actually we don't need it? Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
DBA_HANDLERS(3) 							 1							   DBA_HANDLERS(3)

dba_handlers - List all the handlers available

SYNOPSIS
array dba_handlers ([bool $full_info = false]) DESCRIPTION
dba_handlers(3) list all the handlers supported by this extension. PARAMETERS
o $full_info - Turns on/off full information display in the result. RETURN VALUES
Returns an array of database handlers. If $full_info is set to TRUE, the array will be associative with the handlers names as keys, and their version information as value. Otherwise, the result will be an indexed array of handlers names. Note When the internal cdb library is used you will see cdb and cdb_make. EXAMPLES
Example #1 dba_handlers(3) Example <?php echo "Available DBA handlers: "; foreach (dba_handlers(true) as $handler_name => $handler_version) { // clean the versions $handler_version = str_replace('$', '', $handler_version); echo " - $handler_name: $handler_version "; } ?> The above example will output something similar to: Available DBA handlers: - cdb: 0.75, Revision: 1.3.2.3 - cdb_make: 0.75, Revision: 1.2.2.4 - db2: Sleepycat Software: Berkeley DB 2.7.7: (08/20/99) - inifile: 1.0, Revision: 1.6.2.3 - flatfile: 1.0, Revision: 1.5.2.4 PHP Documentation Group DBA_HANDLERS(3)
All times are GMT -4. The time now is 06:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy