Sponsored Content
Full Discussion: Perl programming issue
Top Forums Shell Programming and Scripting Perl programming issue Post 303030906 by sadique.manzar on Tuesday 19th of February 2019 03:55:04 AM
Old 02-19-2019
Perl programming issue

Dears,

I want to print filename and count of each file in perl but failing to implement.
Code:
`find $srcFolder -maxdepth 1 -type f -name "*$workDate*$fileExt" -exec sh -c '[ -f "$0" ] &&  printf "$workDate|%s|%s\n" "$(wc -l<"$0")" *$workDate*$fileExt' {} \ >> /Sadique/filelog.out \\; 2> /dev/null`;

Output :
Code:
2019-02-18|30501 30501wc -l<FileAgg.pl)|
2019-02-18|30501 30501wc -l<FileAgg.pl)|
2019-02-18|30501 30501wc -l<FileAgg.pl)|
2019-02-18|30501 30501wc -l<FileAgg.pl)|
2019-02-18|30501 30501wc -l<FileAgg.pl)|
2019-02-18|30501 30501wc -l<FileAgg.pl)|
2019-02-18|30501 30501wc -l<FileAgg.pl)|
2019-02-18|30501 30501wc -l<FileAgg.pl)|
2019-02-18|30501 30501wc -l<FileAgg.pl)|
2019-02-18|30501 30501wc -l<FileAgg.pl)|

Expected Output :
Code:
|2019-02-19|402|./Trigger_NLB-B2C_2019-02-18_02-37-09_000000_1.txt
|2019-02-19|58661|./Trigger_NLB-B2C_2019-02-18_12-59-27_000000_1.txt
|2019-02-19|16680|./Trigger_NLB-B2B_2019-02-18_13-07-42_000000_1.txt
|2019-02-19|2543|./Trigger_NLB-B2C_2019-02-18_06-59-10_000000_1.txt
|2019-02-19|3161|./Trigger_NLB-B2C_2019-02-18_05-59-09_000000_1.txt
|2019-02-19|24209|./Trigger_NLB-B2B_2019-02-18_10-07-41_000000_1.txt


Last edited by Neo; 02-19-2019 at 10:28 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

PERL - DB programming

Hi friends, What are the possible ways to connect to DB2 database from Perl (on unix). I need to connect to DB2 and get records for further processing. Can you please suggest the best possible way. I heard about DBI/DBD, if you have some sample scripts please post them too. Thanks in advance. (3 Replies)
Discussion started by: satguyz
3 Replies

2. Shell Programming and Scripting

Sed issue in K Shell programming

I am doing the following script in k shell sed -i 's/FILENAME/$i/g' TEST/test$j.ctl > TEST/control$j.ctl In the file it replaces $i for all FILENAME, it doesnot replace with the value of i. I put single quotes like below sed -i 's/FILENAME/'$i'/g' TEST/test$j.ctl > TEST/control$j.ctl I... (9 Replies)
Discussion started by: toshidas2000
9 Replies

3. Programming

Programming help - Perl !

I am having a text file with Vivek 50 Ram 34 Hulk 45 Vivek 23 Ram 23 Vivek 55 Now I need a perl script to display the fields of 1st column & the 2nd column with summation (& avoid the duplicates). Vivek 128 Ram 57 hulk 45 Plz help me... (1 Reply)
Discussion started by: gameboy87
1 Replies

4. Programming

Help me with perl programming

Hi, i am very beginer to perl, I am reading one xml file and i am creating hash table for that file. i written code like this #!/usr/bin/perl use warnings; use strict; use XML::LibXML::Reader; #Reading XML with a pull parser my $file; open( $file, 'formal.xml'); my $reader =... (8 Replies)
Discussion started by: veerubiji
8 Replies

5. Shell Programming and Scripting

perl programming

how to link the linux files in perl on the local webpage ???? suppose we have some results and want to get them published on the local webpage of our internal site. how this can be done using HTML and perl together , so that the results are published directly on the webpage. thanks kullu (0 Replies)
Discussion started by: kullu
0 Replies

6. Shell Programming and Scripting

Perl programming help

I am trying to make a simple perl program that reads 20 characters upstream from the codon ATG in a given sequence. The following is what I have. I just dont know how to make the program read 20 characters upstream from the ATG codon. print "\nThis program will read 20 characters upstream... (1 Reply)
Discussion started by: patiencenpray
1 Replies

7. Shell Programming and Scripting

Socket Programming in Perl

Hi All I am getting an error when using the below code Receiver use IO::Socket; $sock = new IO::Socket::INET (LocalHost => 'goldengate', LocalPort => 1200, Proto => 'tcp', Listen => 5, Reuse => 1 ); die "Socket could not be created. Reason: $!" unless $sock; while ($new_sock =... (5 Replies)
Discussion started by: parthmittal2007
5 Replies

8. Shell Programming and Scripting

Need help with programming issue

I need a UNIX shellscript command that will remove the 'Paragraph' mark from a simple text file. The Paragraph mark I'm referring to is the special character you can see in a WORD documant (similar to a backwards 'P') when you select the Show Paragraph Marks icon. If someone can give me the... (6 Replies)
Discussion started by: varefump
6 Replies

9. Shell Programming and Scripting

Linux shell programming performance issue

Hi All, can any one help me on this please. Replace sting in FILE1.txt with FILE2.txt. FILE1.txt record must have at least one state is repeated once.But need to replace only from second occurrence in record in FILE1.txt Condition: order of searching the records in FILE2.txt is impartent.... (8 Replies)
Discussion started by: ureddy
8 Replies

10. UNIX for Advanced & Expert Users

AIX runtime programming issue

I hope my title is accurate enough. I have a product that we port to various UNIX platforms. It is known to run on AIX but using the IBM compiler from years ago. Recently we got a different used AIX P5 platform running AIX 5.3 and we setup the GCC compiler (4.4.5 I think). C and C++ source code.... (5 Replies)
Discussion started by: Pug
5 Replies
Perl::OSType(3pm)					 Perl Programmers Reference Guide					 Perl::OSType(3pm)

NAME
Perl::OSType - Map Perl operating system names to generic types VERSION
version 1.003 SYNOPSIS
use Perl::OSType ':all'; $current_type = os_type(); $other_type = os_type('dragonfly'); # gives 'Unix' DESCRIPTION
Modules that provide OS-specific behaviors often need to know if the current operating system matches a more generic type of operating systems. For example, 'linux' is a type of 'Unix' operating system and so is 'freebsd'. This module provides a mapping between an operating system name as given by $^O and a more generic type. The initial version is based on the OS type mappings provided in Module::Build and ExtUtils::CBuilder. (Thus, Microsoft operating systems are given the type 'Windows' rather than 'Win32'.) USAGE
No functions are exported by default. The export tag ":all" will export all functions listed below. os_type() $os_type = os_type(); $os_type = os_type('MSWin32'); Returns a single, generic OS type for a given operating system name. With no arguments, returns the OS type for the current value of $^O. If the operating system is not recognized, the function will return the empty string. is_os_type() $is_windows = is_os_type('Windows'); $is_unix = is_os_type('Unix', 'dragonfly'); Given an OS type and OS name, returns true or false if the OS name is of the given type. As with "os_type", it will use the current operating system as a default if no OS name is provided. SEE ALSO
o Devel::CheckOS SUPPORT
Bugs / Feature Requests Please report any bugs or feature requests through the issue tracker at <https://github.com/dagolden/perl-ostype/issues>. You will be notified automatically of any progress on your issue. Source Code This is open source software. The code repository is available for public review and contribution under the terms of the license. <https://github.com/dagolden/perl-ostype> git clone git://github.com/dagolden/perl-ostype.git AUTHOR
David Golden <dagolden@cpan.org> CONTRIBUTORS
o Jonas B. Nielsen <jonasbn@hoarfrost.local> o Paul Green <Paul.Green@stratus.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by David Golden. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.18.2 2014-01-06 Perl::OSType(3pm)
All times are GMT -4. The time now is 08:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy