This works in ksh when run in the same directory as the target files: -
Your first post had no spaces in the enclosing strings but your second did as well as having unprintable characters so I created a test file with spaces in as a worst case. Running the code as a script called "inch" with these files: -
i have hundreds of directories that have to be renamed. the directory structure is fairly uniform which makes the scripting a little simpler.
suppose i have many directories like this */*/*/*abc* (in other words i have similar directory names 3 dirs deep that all contain the pattern abc in... (8 Replies)
I am trying to use a loop to strip of the funny character ^M at the end of all lines in each file found in current directory and I have used the following in a script:
find . -type f -name '*.txt' | while read file
do
echo "stripping ^M from ..."
ex - "$file" > $tempfile
%s/^M//g
wq!
# mv... (4 Replies)
I have a number of files in directories labeled like this:
/Data/tr_gray/tr_DTI/dti_FA.nii.gz
(the brackets here represent a range of number that the files are labeled with)
I need to rename each dti_FA.nii.gz file according to the name of the folder it resides in. For example, the file ... (3 Replies)
Hi,
We have a file (e.g. a .csv file, but could be any other format), with 2 columns: the old value and the new value. We need to modify all the files within the current directory (including subdirectories), so find and replace the contents found in the first column within the file, with the... (9 Replies)
Hi all,
I have a many folders with zipped files in them. The zipped files are txt files from different folders. The txt files have the same names. If i try to
find . -type f -name "*.zip" -exec cp -R {} /myhome/ZIP \; it fails since the ZIP files from different folders have the same names and... (2 Replies)
Hi,
I have a directory with a lot of files like this:
a.bam
b.bam
c.bam
I like to rename these files based on a list where the name of the files in the first column will be replasced by the names in the second column. Here is my list which is a tab-delimited text file:
a x
b y
c ... (4 Replies)
Hello, I have a text file "file.list" with the contents below.
file1
filename1
file2
filename2
file3
filename3
file1, file2 and file3 are files existing in the same directory as the text file file.list.
I want to rename file1 to filename1, file2 to filename2, as show in the text... (1 Reply)
Hey guys,
I have wrote the following script to apply a module named "trinity" on my files. (it takes two input files and spit a trinity.fasta as output)
#!/bin/bash -l
#SBATCH -p node
#SBATCH -A <projectID>
#SBATCH -n 16
#SBATCH -t 7-00:00:00
#SBATCH --mem=128GB
#SBATCH --mail-type=ALL... (1 Reply)
Hello!
New here although not completely new to Unix.
I wonder how I could rename files based on the data found in a simple textfile.
It goes like this:
I have 4 files
1 ldfgkkfjslkdfjsldkfjsf.wav
2 nndsdflksdjf.wav
3 sdflksjdf jjsdflsdfl.wav
4 dkadsdddd.wav
Textfile.txt looks like... (14 Replies)
Hello Everyone ,
Iam a newbie to shell programming and iam reaching out if anyone can help in this :-
I have two files
1) Insert.txt
2) partition_list.txt
insert.txt looks like this :-
insert into emp1 partition (partition_name)
(a1,
b2,
c4,
s6,
d8)
select
a1,
b2,
c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
LEARN ABOUT SUSE
pdl::gsl::interp
INTERP(3) User Contributed Perl Documentation INTERP(3)NAME
PDL::GSL::INTERP - PDL interface to Interpolation routines in GSL
DESCRIPTION
This is an interface to the interpolation package present in the GNU Scientific Library.
SYNOPSIS
use PDL;
use PDL::GSL::INTERP;
my $x = sequence(10);
my $y = exp($x);
my $spl = PDL::GSL::INTERP->init('cspline',$x,$y);
my $res = $spl->eval(4.35);
$res = $spl->deriv(4.35);
$res = $spl->deriv2(4.35);
$res = $spl->integ(2.1,7.4);
FUNCTIONS
init()
The init method initializes a new instance of INTERP. It needs as input an interpolation type and two piddles holding the x and y values to
be interpolated. The GSL routines require that x be monotonically increasing and a quicksort is performed by default to ensure that. You
can skip the quicksort by passing the option {Sort => 0}.
The available interpolation types are :
o linear
o polynomial
o cspline (natural cubic spline)
o cspline_periodic (periodic cubic spline)
o akima (natural akima spline)
o akima_periodic (periodic akima spline)
Please check the GSL documentation for more information.
Usage:
$blessed_ref = PDL::GSL::INTERP->init($interp_method,$x,$y,$opt);
Example:
$x = sequence(10);
$y = exp($x);
$spl = PDL::GSL::INTERP->init('cspline',$x,$y)
$spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 1}) #same as above
# no sorting done on x, user is certain that x is monotonically increasing
$spl = PDL::GSL::INTERP->init('cspline',$x,$y,{Sort => 0});
eval()
The function eval returns the interpolating function at a given point. By default it will barf if you try to extrapolate, to comply
silently if the point to be evaluated is out of range pass the option {Extrapolate => 1}
Usage:
$result = $spl->eval($points,$opt);
Example:
my $res = $spl->eval($x)
$res = $spl->eval($x,{Extrapolate => 0}) #same as above
# silently comply if $x is out of range
$res = $spl->eval($x,{Extrapolate => 1})
deriv()
The deriv function returns the derivative of the interpolating function at a given point. By default it will barf if you try to
extrapolate, to comply silently if the point to be evaluated is out of range pass the option {Extrapolate => 1}
Usage:
$result = $spl->deriv($points,$opt);
Example:
my $res = $spl->deriv($x)
$res = $spl->deriv($x,{Extrapolate => 0}) #same as above
# silently comply if $x is out of range
$res = $spl->deriv($x,{Extrapolate => 1})
deriv2()
The deriv2 function returns the second derivative of the interpolating function at a given point. By default it will barf if you try to
extrapolate, to comply silently if the point to be evaluated is out of range pass the option {Extrapolate => 1}
Usage:
$result = $spl->deriv2($points,$opt);
Example:
my $res = $spl->deriv2($x)
$res = $spl->deriv2($x,{Extrapolate => 0}) #same as above
# silently comply if $x is out of range
$res = $spl->deriv2($x,{Extrapolate => 1})
integ()
The integ function returns the integral of the interpolating function between two points. By default it will barf if you try to
extrapolate, to comply silently if one of the integration limits is out of range pass the option {Extrapolate => 1}
Usage:
$result = $spl->integ($a,$b,$opt);
Example:
my $res = $spl->integ($a,$b)
$res = $spl->integ($a,$b,{Extrapolate => 0}) #same as above
# silently comply if $a or $b are out of range
$res = $spl->eval($a,$b,{Extrapolate => 1})
BUGS
Feedback is welcome.
SEE ALSO
PDL
The GSL documentation is online at
http://sources.redhat.com/gsl/ref/gsl-ref_toc.html
AUTHOR
This file copyright (C) 2003 Andres Jordan <andresj@physics.rutgers.edu> All rights reserved. There is no warranty. You are allowed to
redistribute this software/documentation under certain conditions. For details, see the file COPYING in the PDL distribution. If this file
is separated from the PDL distribution, the copyright notice should be included in the file.
The GSL interpolation module was written by Gerard Jungman.
perl v5.12.1 2010-07-05 INTERP(3)