Sponsored Content
Full Discussion: Join Function in PERL
Top Forums Shell Programming and Scripting Join Function in PERL Post 302427277 by thankful123 on Friday 4th of June 2010 11:55:00 AM
Old 06-04-2010
Thanks...bartus11, it didnt worked.. please help

Hey bartus11

I tried as below with the code you gave, but it dint worked can you please let me know where am doing a mistake.

#!/usr/bin/perl
use strict;
my $dt=`date +%Y-%m-%d`;
chomp $dt;

my $inp_file=""/home/skMessages.log";

{
chomp $inp_file;
open (INFILE,"$inp_file") || die "Cant open $inp_file for reading ";

while (<INFILE>)
{
if ($_ =~ $dt)
{
$_="\n" . $_;$\="\n";
print;
}
}
}
close(INFILE);

---------- Post updated at 11:55 AM ---------- Previous update was at 11:53 AM ----------

Quote:
Originally Posted by thankful123
Hey bartus11

I tried as below with the code you gave, but it dint worked can you please let me know where am doing a mistake.
Code:
#!/usr/bin/perl
use strict;
my $dt=`date +%Y-%m-%d`;
chomp $dt;
 
my $inp_file=""/home/skMessages.log";
 
{
chomp $inp_file;
open (INFILE,"$inp_file") || die "Cant open $inp_file for reading ";
 
while (<INFILE>)
{
if ($_ =~ $dt)
{
$_="\n" . $_;$\="\n";
print;
}
}
}
close(INFILE);

 

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
LTSINFO(1)							   User Commands							LTSINFO(1)

NAME
ltsinfo - display basic information about an LTS SYNOPSIS
ltsinfo [OPTION]... [INFILE] DESCRIPTION
Print information about the labelled transition system (LTS) in INFILE. If INFILE is not supplied, stdin is used. The format of INFILE is determined by its contents. The option --in can be used to force the format for INFILE. The supported formats are: 'aut' for the Aldebaran format (CADP), 'dot' for the GraphViz format, 'fsm' for the Finite State Machine format, 'lts' for the mCRL2 LTS format, or 'svc' for the SVC format OPTIONS
OPTION can be any of the following: -iFORMAT, --in=FORMAT use FORMAT as the input format --timings[=FILE] append timing measurements to FILE. Measurements are written to standard error if no FILE is provided Standard options: -q, --quiet do not display warning messages -v, --verbose display short intermediate messages -d, --debug display detailed intermediate messages --log-level=LEVEL display intermediate messages up to and including level -h, --help display help information --version display version information AUTHOR
Written by Muck van Weerdenburg. REPORTING BUGS
Report bugs at <http://www.mcrl2.org/issuetracker>. COPYRIGHT
Copyright (C) 2012 Technische Universiteit Eindhoven. This is free software. You may redistribute copies of it under the terms of the Boost Software License <http://www.boost.org/LICENSE_1_0.txt>. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
See also the manual at <http://www.mcrl2.org/mcrl2/wiki/index.php/User_manual/ltsinfo>. ltsinfo mCRL2 toolset 201202.0 (Release) April 2012 LTSINFO(1)
All times are GMT -4. The time now is 11:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy