Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Reading the dates from a file & moving the files from a directory Post 302653157 by dsfreddie on Friday 8th of June 2012 12:49:10 PM
Old 06-08-2012
Reading the dates from a file & moving the files from a directory

Hi All,

I am coding for a requirement where I need to read a file & get the values of SUB_DATE. Once the dates are found, i need to move the files based on these dates from one directory to another.

ie, this is how it will be in the file,

SUB_DATE = 20120608,20120607,20120606,20120606

Now, i need to move the file (with filename like a.20120608,a.20120607 etc) from /path/source to /path/destination.

Can anybody shed some light on how to achieve this ?

Thanks Much
Freddie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

reading files for specific dates

assume files are in a directory /data $ ls -ltr Just displaying Data and file name: 01/01/2004 file_3434_typea.dat 01/01/2004 file_3423_typea.dat 01/01/2004 file_3436_typea.dat 01/01/2004 file_3434_typeb.dat 01/01/2004 file_3423_typeb.dat 01/01/2004 file_3436_typeb.dat ... (3 Replies)
Discussion started by: siva_jm
3 Replies

2. Shell Programming and Scripting

Question on reading dates in folders/files

Hi All, I have some folder that are named "FOLDERYYYYMM". I'm trying to piece together a .sh script that will look for the folder with the date. How can I get shell to see the date? (3 Replies)
Discussion started by: bbbngowc
3 Replies

3. Shell Programming and Scripting

Moving files listed in a data file to a new directory using Perl

Hi, I have a data file that lists a number of files. I want to move the files named in that one to another directory. Here's what I have: #!/usr/bin/perl -w open(FILE, "<collision.txt"); my @lines=<FILE>; foreach my $lines (@lines) { system("mv $lines collisions/."); } close(FILE); ... (2 Replies)
Discussion started by: renthead720
2 Replies

4. Shell Programming and Scripting

Search & Replace in Multiple Files by reading a input file

Hi, I have a folder which contains multiple config.xml files and one input file, Please see the below format. Config Files format looks like :- Code: <application name="SAMPLE-ARCHIVE"> <NVPairs name="Global Variables"> <NameValuePair> ... (0 Replies)
Discussion started by: haiksuresh
0 Replies

5. UNIX for Dummies Questions & Answers

Need Help in reading N days files from a Directory & combining the files

Hi All, Request your expertise in tackling one requirement in my project,(i dont have much expertise in Shell Scripting). The requirement is as below, 1) We store the last run date of a process in a file. When the batch run the next time, it should read this file, get the last run date from... (1 Reply)
Discussion started by: dsfreddie
1 Replies

6. Shell Programming and Scripting

Grepping file names, comparing them to a directory of files, and moving them into a new directory

got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies

7. Shell Programming and Scripting

Search & Replace in Multiple Files by reading a input file

I have a environment property file which contains: Input file: value1 = url1 value2 = url2 value3 = url3 and so on. I need to search all *.xml files under directory for value1 and replace it with url1. Same thing I have to do for all values mentioned in input file. I need script in unix bash... (7 Replies)
Discussion started by: Shamkamde
7 Replies

8. UNIX for Advanced & Expert Users

Find all files other than first two files dates & last file date for month

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (16 Replies)
Discussion started by: Makarand Dodmis
16 Replies

9. Shell Programming and Scripting

Moving files into dirs corresponding to dates

I am trying to find a way to move files into corresponding date files. i=0 while read line do array="$line" (( i++ )) done < <(ls) cd $(echo ${array}) echo ${array}} pwd #cd "$(array}" ] || mkdir 2015 cd "2015" ] || mkdir 02-February ] || mkdir 03-March ] || mkdir... (10 Replies)
Discussion started by: newbie2010
10 Replies

10. Red Hat

Moving files with specific dates

Hi, These are the list of files in one directory in the server : # ls -lrt total 10120 -rw-r--r-- 1 root root 4484 Jul 8 2011 install.log.syslog -rw-r--r-- 1 root root 51890 Jul 8 2011 install.log -rw------- 1 root root 3140 Jul 8 2011 anaconda-ks.cfg drwxr-xr-x 2 root root... (2 Replies)
Discussion started by: anaigini45
2 Replies
GFREP(1)																  GFREP(1)

NAME
gfrep - replicate Gfarm files SYNOPSIS
gfrep [ -mnqvx ] [ -S source-domainname ] [ -D destination-domainname ] [ -h source-hostfile ] [ -H destination-hostfile ] [ -N num-of- replicas ] [ -j num-of-threads ] path ... DESCRIPTION
gfrep creates specified number of replicas of Gfarm files specified by the path to specified set of destination hosts. When set of source hosts are specified, only files stored on the set of source hosts are replicated. A set of hosts can be specified by a domain name and/or a host file. When both a domain name and a host file are specified, a set of hosts is determined by both conditions. If the path parameter is a directory, files under the directory will be copied recursively. OPTIONS
-S source-domainname Specifies the domain name of source filesystem nodes from which replicas will be copied. -D destination-domainname Specifies the domain name of destination filesystem nodes to which replicas will be copied. If neither this nor the -H option is specified, replicas may be copied to any available host. -h source-hostfile Specifies a file which describes hostnames of source filesystem nodes from which the replica will be made. The source-hostfile con- sists of a filesystem node name on each line. if ``-'' is specified, standard input is used to read the host list. -H destination-hostfile Specifies a file which describes hostnames of destination filesystem nodes on which the replica will be made. The destination-host- file consists of a filesystem node name on each line. if ``-'' is specified, standard input is used to read the host list. -N num-of-replicas Specifies the required number of file replicas, counting already existing ones. If there are a sufficient number of replicas in the destination hosts, neither any copying nor any removal will be done. If this option is not specified, -N 1 is assumed. -j num-of-threads Specifies the number of threads to create file replicas simultaneously. This option is only available when compiled by an OpenMP C compiler. By default, it will be the smallest among the number of total files, the number of source hosts, and the number of desti- nation hosts. -m Lets gfrep command do a migrate/move, instead of doing replication. -x Removes file replicas when a set of destination nodes has more file replicas than specified. -n Displays files to be replicated, but does nothing. -q Suppresses non-error messages. -v Displays verbose output. -? Displays a list of command options. BUGS
A source host is not always selected within a set of source hosts. Gfarm 09 November 2009 GFREP(1)
All times are GMT -4. The time now is 03:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy