Sponsored Content
Top Forums UNIX for Dummies Questions & Answers finding and moving files based on the last three numerical characters in the filename Post 302519773 by roche.j.mike on Thursday 5th of May 2011 04:04:38 AM
Old 05-05-2011
Quote:
Originally Posted by Peasant
Best guess would be to use find for this, and matching regex.

Something like :
Code:
find $FINDDIR -name 'CC10-1234P1[01][0-5][0-5].WGS84.p190' -type f | xargs cp -t $DESTDIR

That one rung a few bells so with a little redesign I came up with (transferring 001-132 this time)

find ./ \( -name "*[0][0-9][0-9].WGS84.p190" -o -name "*[1][3][0-2].WGS84.p190" -o -name "*[1][0-2][0-9].WGS84.p190" \) -exec scp -v {} $DESTDIRp190/ \;


That works a treat, thanks guys, much appreciated
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Moving files by splitting the path embedded in the filename

Hello All. I am having a directory /tmp/rahul which contains many files in the format @#home@#rahul@#programs@#script.pl where /home/rahul/programs is the directory where the script.pl file is to be placed. I have many files in this format. What i want is a script which read these... (7 Replies)
Discussion started by: rahulrathod
7 Replies

2. Shell Programming and Scripting

moving files with spaces in filename from one directory to another

Hello, When I run following script #!/bin/bash cd ~/directory1 mv `ls -trF | grep -v / | tail -10 ` ~/directory2 works fine with filenames not having any space but runs into issues with filenames that have spaces tried with $file variable still doesnot work. Can someone help me (4 Replies)
Discussion started by: asakhare
4 Replies

3. UNIX for Dummies Questions & Answers

Moving files out of multiple directories and renaming them in numerical order

Hi, I have 500 directories each with multiple data files inside them. The names are sort of random. For example, one directory has files named e_1.dat, e_5.dat, e_8.dat, etc. I need to move the files to a single directory and rename them all in numerical order, from 1.dat to 1000(or some... (1 Reply)
Discussion started by: renthead720
1 Replies

4. Shell Programming and Scripting

Finding files with filename format

hi all, i'm trying to find out how to show files having a particular format. i.e. files o570345.out o5703451.out XX_570345_1.RTF so when i search for files using ls *570345* it shows all three files but actually i don't like to see the second file o5703451.out because 5703451 is... (6 Replies)
Discussion started by: adshocker
6 Replies

5. UNIX for Dummies Questions & Answers

moving/copying files in a numerical order

Hi I am newbie to unix scripting, but i have enough knowledge to understand. I have a specific questions like, I use to collect like 3500 files per experiment, each one named like data_001.img.. data_002.img data_003.img .... data_3500.img I would like to move every 12 files in the 3500... (3 Replies)
Discussion started by: wpat
3 Replies

6. Shell Programming and Scripting

Finding File Names Ending In 3 Random Numerical Characters

Hi, I have a series of files (upwards of 500) the filename format is as follows CC10-1234P1999.WGS84.p190 each of this files is in a directory named for the file but excluding the extension. Now the last three numeric characters, in this case 999, can be anything from 001 to 999, I need to... (3 Replies)
Discussion started by: roche.j.mike
3 Replies

7. UNIX for Dummies Questions & Answers

Finding files with one row then moving them

Hi guys can you please help me with a script to find files with one row the move the file to another directory the files are in /optima/prd/optdir/ZTE_BSS/Combiner/ZTE_2G/out/BSC_PS_Basic_Meas and I want to move them to /optima/prd/optdir/ZTE_BSS/Loader/error/ZTE_2G/BSC_PS_Basic_Meas ... (5 Replies)
Discussion started by: Dj Moi
5 Replies

8. Shell Programming and Scripting

Finding files with wc -l results = 1 then moving the files to another folder

Hi guys can you please help me with a script to find files with one row/1 line of content then move the file to another directory my script below runs but nothing happens to the files....Alternatively Ca I get a script to find the *.csv files with "wc -1" results = 1 then create a list of those... (5 Replies)
Discussion started by: Dj Moi
5 Replies

9. UNIX for Dummies Questions & Answers

Finding filename based on filecontent

Hi, I have been trying , to find the filename based on some pattern present inside the file My command is as follows: filename=`grep -l 'Pattern' path/*.txt ` Its strange that it works some times, but doesn't print anything some times . But my if test -f $filename is passing all the... (2 Replies)
Discussion started by: Prashanth19
2 Replies

10. Shell Programming and Scripting

Finding files with newlines in filename

I want to use grep to find files that have newlines in the filename. For example, I have a directory where I create three files: $ touch file1 $ touch "file 2" $ touch "file > with > newlines" $ find . ./file 2 ./file1 ./file?with?newlinesI now want to pipe the find output into grep and... (4 Replies)
Discussion started by: Ralph
4 Replies
Geo::Proj(3pm)						User Contributed Perl Documentation					    Geo::Proj(3pm)

NAME
Geo::Proj - Handling projections SYNOPSIS
use Geo::Proj; my $wgs84 = Geo::Proj->new # predefined if import() ( nick => 'wgs84' , proj4 => '+proj=latlong +datum=WGS84 +ellps=WGS84' ); my $clrk = Geo::Proj->new ( nick => 'clark66' , proj4 => [proj => "merc", ellps => "clrk66", lon_0 => -96] ); my $point_wgs84= Geo::Point->latlong(56.12, 4.40, 'wgs84'); my $point_wgs84= Geo::Point->latlong(56.12, 4.40, $wgs84); my $point_clrk = $point_wgs84->in($clrk); my $point_clrk = Geo::Proj->to($wgs84, $clrk, $point_wgs84); my $point_clrk = Geo::Proj->to($wgs84, 'clark66', $point_wgs84); DESCRIPTION
A point on Earth's surface can be represented in many different coordinate systems. The Geo::Proj4 module wraps the popular Open Source "libproj" library to convert between those coordinate systems; a very complex job. Within a program, however, you like some extra abstraction from that library: to be able to simply label a point to its system, and then forget about all transformations which may be necessary. The label (or "nick") hides all complicated parameters for the actual projection . WARNING 1: this class will collect all nicks, which means that calling new() with the same label twice will have the second ignored. WARNING 2: the wgs84 nickname is predefined, but only if this module is 'used' with import. So if you decide to use 'require' to dynamically load this module, then don't forget to call 'import()' yourself, or define the wgs84 projection yourself. METHODS
Constructors Geo::Proj->new([NICK], OPTIONS) Create a new object. Option--Default name <from proj4> nick <required> proj4 <required> srid undef . name => STRING . nick => LABEL The abbrevated name for this projection. . proj4 => OBJECT|ARRAY|STRING The ARRAY or STRING will by used to create a Geo::Proj4 object by calling Geo::Proj4::new(). You may also specify such an prepared OBJECT. . srid => INTEGER SRID stands for "Spatial Reference System ID", which is just an index in a table of spatial descriptions as used by SQL. Only INTEGER values larger than 0 are permitted. Attributes $obj->name The full, official name of the projection $obj->nick Simple abbreviating of the projection. $obj->proj4([NICK|PROJ4]) Geo::Proj->proj4([NICK|PROJ4]) Returns the projection library handle (a Geo::Proj4) to be used by this component. As class method, the NICK is specified for a lookup. In case a PROJ4 is specified, that is returned. example: my $wgs84 = Geo::Proj->new(nick => 'wgs84', ...); my $wgs84_proj4 = Geo::Proj->proj4('wgs84'); my $wgs84_proj4 = Geo::Proj->proj4($wgs84); my $wgs84_proj4 = $wgs84->proj4; $obj->srid The "Spatial Reference System ID" if known. Projecting Geo::Proj->defaultProjection([NICK|PROJ]) The NICK must be defined with new(). Returned is the Geo::Proj object for the default projection. The default is the first name created, which probably is 'wgs84' (when import() had a chance) Geo::Proj->dumpProjections([FILEHANDLE]) Print details about the defined projections to the FILEHANDLE, which defaults to the selected. Especially useful for debugging. Geo::Proj->listProjections Returns a sorted lost of projection nicks. Geo::Proj->projection(NICK|PROJ) Returns the Geo::Proj object, defined with NICK. In case such an object is passed in as PROJ, it is returned unaffected. This method is used where in other methods NICKS or PROJ can be used as arguments. example: my $wgs84 = Geo::Proj->projection('wgs84'); my $again = Geo::Proj->projection($wgs84); $obj->to([PROJ|NICK], PROJ|NICK, POINT|ARRAY-OF-POINTS) Geo::Proj->to([PROJ|NICK], PROJ|NICK, POINT|ARRAY-OF-POINTS) Expects an Geo::Proj to project the POINT or POINTS to. The work is done by Geo::Proj4::transform(). As class method, you have to specify two nicks or projections. Be warned that this to() method expects POINTs which are not Geo::Point objects, but which themselves are an ARRAY containing X,Y and optionally a Z coordinate. example: my $p2 = $wgs84->to('utm31-wgs84', $p1); my $p2 = $wgs84->to($utm, $p1); my $p2 = Geo::Proj->to('wgs84', 'utm31-wgs84', $p1); UTM Geo::Proj->UTMprojection(DATUM|PROJ|undef, ZONE) The PROJ is a Geo::Proj which is used to collect the datum information from if no DATUM was specified explicitly. It may also be a string which is the name of a datum, as known by proj4. Undef will be replaced by the default projection. example: my $proj = Geo::Proj->UTMprojection('WGS84', 31) or die; print $proj->nick; # for instance utm31-wgs84 $obj->bestUTMprojection(POINT, [PROJ|NICK]) Geo::Proj->bestUTMprojection(POINT, [PROJ|NICK]) Returns the best UTM projection for some POINT. As class method, you specify the nickname or the object for the point. example: my $point = Geo::Point->longlat(2.234, 52.12); my $proj = Geo::Proj->bestUTMprojection($point); print $proj->nick; # for instance utm31-wgs84 $obj->zoneForUTM(POINT) Geo::Proj->zoneForUTM(POINT) Provided some point, figure-out which zone is most optimal for representing the point. In LIST context, zone number, zone letter, and meridian are returned as separate scalars. In LIST context, the zone number and letter are returned as one.. This code is stolen from Geo::Coordinates::UTM, because that module immediately starts to do computations with this knowledge, which is not wanted here. Probably a lot of zones are missing. SEE ALSO
This module is part of Geo-Point distribution version 0.93, built on May 19, 2010. Website: http://perl.overmeer.net/geo/ All modules in this suite: "Geo::Point", "Geo::Proj4", "Geo::WKT", "Math::Polygon", "Geo::GML", "Geo::ISO19139", "Geo::EOP", "Geo::Format::Envisat", and "Geo::Format::Landsat". Please post questions or ideas to the mailinglist at http://geo-perl@list.hut.fi LICENSE
Copyrights 2005-2010 by Mark Overmeer. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.14.2 2010-05-19 Geo::Proj(3pm)
All times are GMT -4. The time now is 06:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy