Sponsored Content
Top Forums Shell Programming and Scripting How to check files and move the results to differents files? Post 302329234 by sandhyagupta on Friday 26th of June 2009 09:21:15 AM
Old 06-26-2009
How to check files and move the results to differents files?

Hi,

I am a newbie to shell scripting. here is my objective:
1)The shell program should take 2 parameters - ie-> DestinationFolder, WebFolder
2)Destination folder contains few files that has to has be verified and deleted.
3)WebFolder is a folder containing a list of master files
4)It should output 3 files - InWebFolder.txt, MalformedMailIDs.txt, NotInWebFolder.txt. THIS IS THE END RESULT
5)For each file in DestinationFolder
  1. Find if it contains a valid mail ID.
  2. If no,
    1. see if there is an "@" in the file. If yes, write the full filename and path in the MalformedMailIDs.txt file
    2. If there is no "@" symbol, the file is simply to be discarded
  3. Check if that ID is found in WebFolder.
    1. If not present, retain the file and put the filename in the NotInWebFolder.txt file
    2. If present, delete that file and put the full filename in the InWebFolder.txt file
How do i do this. can anyone plz guide me.
thanks in advance
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script That Can navigate to 3 differents directory & remove files under them

Hi I am Trying to Write a script that can goto 4 different directorys on the server & remove the Files older then 30 days ?? /logs logs1 logs2 logs3 Now I need to remove files under logs1 logs2 logs3 which are older then 30 days whose name stat 'sit' , 'mig','bld' . in... (3 Replies)
Discussion started by: Beginner123
3 Replies

2. UNIX for Dummies Questions & Answers

Move same files and issue ls -al command on remaining files

I know I can use an ls -l junk1 command to get a listing of all files in the directory junk1, but I was wondering how I'd go about going through the files in junk1 in a for-in loop and issuing the ls -l command on them one by one. This is what I have so far: for file in $(ls -a $1) do ls... (1 Reply)
Discussion started by: Trinimini
1 Replies

3. Shell Programming and Scripting

Recursively move directories along with files/specific files

I would like to transfer all files ending with .log from /tmp and to /tmp/archive (using find ) The directory structure looks like :- /tmp a.log b.log c.log /abcd d.log e.log When I tried the following command , it movies all the log files... (8 Replies)
Discussion started by: frintocf
8 Replies

4. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

5. 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

6. Shell Programming and Scripting

Move all files except sys date (today) files in Solaris 10

I want to move all files from one directory to another directory excluding today (sysdate files) on daily basis. file name is in pattern file_2013031801, file_2013031802 etc (2 Replies)
Discussion started by: khattak
2 Replies

7. Shell Programming and Scripting

SBATCH trinity for multiple files and rename/move the output files

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)
Discussion started by: @man
1 Replies

8. Shell Programming and Scripting

Move files with a certain suffix based on how many files are in another folder

Hello, First time poster. I am looking for a way to script or program the process of moving files from one folder to another, automatically, based on the count of files in the destination folder. I was thinking a shell script would work, but am open to the suggestions of the experts... (6 Replies)
Discussion started by: comtech
6 Replies

9. UNIX for Beginners Questions & Answers

Check for files and move it to another directory - ksh

I'm trying to wirte ksh script for given requirement, but i unable to achive it. In dir1 directory I need to check for the files which suffixed with .csv or .txt, If there is no files, then i need to exit. If any files found I need to move the each file found to dir2 directory. I have to repeat... (4 Replies)
Discussion started by: Kayal
4 Replies
lib(3perl)						 Perl Programmers Reference Guide						lib(3perl)

NAME
lib - manipulate @INC at compile time SYNOPSIS
use lib LIST; no lib LIST; DESCRIPTION
This is a small simple module which simplifies the manipulation of @INC at compile time. It is typically used to add extra directories to perl's search path so that later "use" or "require" statements will find modules which are not located on perl's default search path. Adding directories to @INC The parameters to "use lib" are added to the start of the perl search path. Saying use lib LIST; is almost the same as saying BEGIN { unshift(@INC, LIST) } For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is added to @INC in front of $dir. lib.pm also checks if directories called $dir/$version and $dir/$version/$archname exist and adds these directories to @INC. The current value of $archname can be found with this command: perl -V:archname The corresponding command to get the current value of $version is: perl -V:version To avoid memory leaks, all trailing duplicate entries in @INC are removed. Deleting directories from @INC You should normally only add directories to @INC. If you need to delete directories from @INC take care to only delete those which you added yourself or which you are certain are not needed by other modules in your script. Other modules may have added directories which they need for correct operation. The "no lib" statement deletes all instances of each named directory from @INC. For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is also deleted from @INC. Restoring original @INC When the lib module is first loaded it records the current value of @INC in an array @lib::ORIG_INC. To restore @INC to that value you can say @INC = @lib::ORIG_INC; CAVEATS
In order to keep lib.pm small and simple, it only works with Unix filepaths. This doesn't mean it only works on Unix, but non-Unix users must first translate their file paths to Unix conventions. # VMS users wanting to put [.stuff.moo] into # their @INC would write use lib 'stuff/moo'; NOTES
In the future, this module will likely use File::Spec for determining paths, as it does now for Mac OS (where Unix-style or Mac-style paths work, and Unix-style paths are converted properly to Mac-style paths before being added to @INC). If you try to add a file to @INC as follows: use lib 'this_is_a_file.txt'; "lib" will warn about this. The sole exceptions are files with the ".par" extension which are intended to be used as libraries. SEE ALSO
FindBin - optional module which deals with paths relative to the source file. PAR - optional module which can treat ".par" files as Perl libraries. AUTHOR
Tim Bunce, 2nd June 1995. "lib" is maintained by the perl5-porters. Please direct any questions to the canonical mailing list. Anything that is applicable to the CPAN release can be sent to its maintainer, though. Maintainer: The Perl5-Porters <perl5-porters@perl.org> Maintainer of the CPAN release: Steffen Mueller <smueller@cpan.org> COPYRIGHT AND LICENSE
This package has been part of the perl core since perl 5.001. It has been released separately to CPAN so older installations can benefit from bug fixes. This package has the same copyright and license as the perl core. perl v5.14.2 2014-09-29 lib(3perl)
All times are GMT -4. The time now is 03:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy