Tag Archives: File Copy

Moving multiple filetype in a single loop

By pandeesh

Hi,
I am using the below code to move *.sh files to another directory.

Code:

use File::Copy qw(move);

while()
{

move $_,"C:/Users/pandeesh/Desktop/Projects";

}


My requirement is i want to move *.sh,*.txt,*.xlsx,*.doc,*.pdf and *.epub files to the specified directory.

How i can specify the pattern in the while condition for achieving this?

Thanks

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Blade 1500 Silver

By MadeInGermany

CPU/Speed: UltraSPARC-IIIi/1.5Ghz
Ram: 1GB
Motherboard: Sparc
Bus: PCI
Cache:
Controller:
Disk: ATA
Load: 1 user
Kernel: SunOS 5.10 Generic_137111-02
Kernel ELF?: yes
pgms: gcc 2.95.3 compiled

BYTE UNIX Benchmarks (Version 3.11)
System — SunOS aachen95 5.10 Generic_137111-02 sun4u sparc SUNW,Sun-Blade-1500
Start Benchmark Run: Tue Feb 12 18:36:33 MET 2013
10 interactive users.
Dhrystone 2 without register variables 2368680.4 lps (10 secs, 6 samples)
Dhrystone 2 using register variables 2138532.7 lps (10 secs, 6 samples)
Arithmetic Test (type = arithoh) 3047742.0 lps (10 secs, 6 samples)
Arithmetic Test (type = register) 145400.3 lps (10 secs, 6 samples)
Arithmetic Test (type = short) 126624.1 lps (10 secs, 6 samples)
Arithmetic Test (type = int) 143236.6 lps (10 secs, 6 samples)
Arithmetic Test (type = long) 157815.3 lps (10 secs, 6 samples)
Arithmetic Test (type = float) 444529.1 lps (10 secs, 6 samples)
Arithmetic Test (type = double) 407111.3 lps (10 secs, 6 samples)
System Call Overhead Test 247231.5 lps (10 secs, 6 samples)
Pipe Throughput Test 350931.2 lps (10 secs, 6 samples)
Pipe-based Context Switching Test 82263.6 lps (10 secs, 6 samples)
Process Creation Test 934.4 lps (10 secs, 6 samples)
Execl Throughput Test 273.1 lps (9 secs, 6 samples)
File Read (10 seconds) 711424.0 KBps (10 secs, 6 samples)
File Write (10 seconds) 1000.0 KBps (10 secs, 6 samples)
File Copy (10 seconds) 1004.0 KBps …read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Perl string formation from array

HI I ma using perl programming

my perl is like this

Code:

$InputFile = $ENV{UDE_TMP} . “/” .”cre_fmr_gen.temp_data_file_gen.dat”;
@duplicates = `cat $InputFile | cut -d “|” -f 1,1 | sort | uniq -c | awk ‘{ if($1>1) {print $2;}}’`;
my $cusiplist ;
foreach $cusip (@duplicates)
{
print(“instrument is $cusip”);
$cusiplist = $cusiplist . “|” . $cusip ;
}
print($cusiplist);
$tmp_file_1 = $ENV{UDE_TMP} . “/” .”prabhu1″;
$tmp_file_2 = $ENV{UDE_TMP} . “/” .”prabhu2″;
print($tmp_file_2 );
#$InputFile = $ENV{UDE_TMP} . “/” .”cre_fmr_gen.temp_data_file_gen.dat”;
print (“$InputFile “);
use File::Copy;
copy( “$InputFile” , “$InputFile.CP.Prabhu”);
$cmd = `cat $InputFile | egrep ‘$cusiplist’ > $tmp_file_1`;
#$cmd= `cat $InputFile >$tmp_file_I`;
system(cmd);
print($cmd);
so now i am getting the out put as

Code:
instrument is FN110OY12
instrument is FN112OY10
instrument is FN112OY11
instrument is FN112OY12
instrument is FN114OY03
instrument is FN114OY09
instrument is FN114OY10
instrument is FN114OY11
instrument is FN114OY12
instrument is FN116OY03
instrument is FN116OY04
instrument is FN116OY05
instrument is FN116OY09
instrument is FN116OY10
instrument is FN118OY03
instrument is FN118OY04
instrument is FN118OY05
instrument is FN118OY08
instrument is FN118OY09
instrument is FN118OY10
instrument is FN120OY03
instrument is FN120OY08
instrument is FN122OY05
instrument is FN122OY07
instrument is FN124OY08
|FN110OY12
|FN112OY10
|FN112OY11
|FN112OY12
|FN114OY03
|FN114OY09
|FN114OY10
|FN114OY11
|FN114OY12
|FN116OY03
|FN116OY04
|FN116OY05
|FN116OY09
|FN116OY10
|FN118OY03
|FN118OY04
|FN118OY05
|FN118OY08
|FN118OY09
|FN118OY10
|FN120OY03
|FN120OY08
|FN122OY05
|FN122OY07
|FN124OY08
/itf/ude/tmp/prabhu2/itf/ude/tmp/cre_fmr_gen.temp_data_file_gen.dat
But I wanted to make a string like this

‘FN112OY12|FN114OY10|FN116OY03|FN116OY04|FN116OY05|FN118OY03|FN118OY04|FN118OY05|FN118OY08|FN118OY10 |FN120OY02
|FN120OY08|FN122OY05|FN124OY08’

what needs to be done?
Source: The UNIX and Linux Forums

Perl string formation from arry

HI I ma using perl programming

my perl is like this

Code:

$InputFile = $ENV{UDE_TMP} . “/” .”cre_fmr_gen.temp_data_file_gen.dat”;
@duplicates = `cat $InputFile | cut -d “|” -f 1,1 | sort | uniq -c | awk ‘{ if($1>1) {print $2;}}’`;
my $cusiplist ;
foreach $cusip (@duplicates)
{
print(“instrument is $cusip”);
$cusiplist = $cusiplist . “|” . $cusip ;
}
print($cusiplist);
$tmp_file_1 = $ENV{UDE_TMP} . “/” .”prabhu1″;
$tmp_file_2 = $ENV{UDE_TMP} . “/” .”prabhu2″;
print($tmp_file_2 );
#$InputFile = $ENV{UDE_TMP} . “/” .”cre_fmr_gen.temp_data_file_gen.dat”;
print (“$InputFile “);
use File::Copy;
copy( “$InputFile” , “$InputFile.CP.Prabhu”);
$cmd = `cat $InputFile | egrep ‘$cusiplist’ > $tmp_file_1`;
#$cmd= `cat $InputFile >$tmp_file_I`;
system(cmd);
print($cmd);
so now i am getting the out put as

Code:
instrument is FN110OY12
instrument is FN112OY10
instrument is FN112OY11
instrument is FN112OY12
instrument is FN114OY03
instrument is FN114OY09
instrument is FN114OY10
instrument is FN114OY11
instrument is FN114OY12
instrument is FN116OY03
instrument is FN116OY04
instrument is FN116OY05
instrument is FN116OY09
instrument is FN116OY10
instrument is FN118OY03
instrument is FN118OY04
instrument is FN118OY05
instrument is FN118OY08
instrument is FN118OY09
instrument is FN118OY10
instrument is FN120OY03
instrument is FN120OY08
instrument is FN122OY05
instrument is FN122OY07
instrument is FN124OY08
|FN110OY12
|FN112OY10
|FN112OY11
|FN112OY12
|FN114OY03
|FN114OY09
|FN114OY10
|FN114OY11
|FN114OY12
|FN116OY03
|FN116OY04
|FN116OY05
|FN116OY09
|FN116OY10
|FN118OY03
|FN118OY04
|FN118OY05
|FN118OY08
|FN118OY09
|FN118OY10
|FN120OY03
|FN120OY08
|FN122OY05
|FN122OY07
|FN124OY08
/itf/ude/tmp/prabhu2/itf/ude/tmp/cre_fmr_gen.temp_data_file_gen.dat
But I wanted to make a string like this

‘FN112OY12|FN114OY10|FN116OY03|FN116OY04|FN116OY05|FN118OY03|FN118OY04|FN118OY05|FN118OY08|FN118OY10 |FN120OY02
|FN120OY08|FN122OY05|FN124OY08’

what needs to be done?
Source: The UNIX and Linux Forums