Sponsored Content
Top Forums UNIX for Dummies Questions & Answers If condition to check one file newer than the other Post 302761427 by tukuyomi on Friday 25th of January 2013 03:06:45 PM
Old 01-25-2013
You're missing a [space] after '[' (edit) and the $ too (thanks RudiC^^)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to check for a condition inside a file

Hi I am writing a script file which sends the log files along with their size in a folder named log to a file called temp.log using the following cmd: ls -st 190_GSTV_HUX_003QISCGSK026** >> /home/user/temp.log the temp.log looks like this: 16 190_GSTV_HUX_003QISCGSK026_message070321.log ... (11 Replies)
Discussion started by: kiran1112
11 Replies

2. Shell Programming and Scripting

If condition to check one file newer than the other - first file name uncertain

Dear All, I'm new to unix scripting. I'm trying to write an utility script which has to check if one file is newer than another one. The condition is I dont know the full name of the first file. I searched google and this forum for any such examples, but couldn't find any or may be I would have... (9 Replies)
Discussion started by: achilles5
9 Replies

3. Shell Programming and Scripting

How to script to find the newer date in a text file?

Hi, I have a text file, foo.txt, it looks something like below. In the file there is a line that gives the date in the form of: Mon Jun 15 11:09:31 2008. I need to find which date is the newest and then store certain details of that list data to another file. So, in this sample text file, I... (6 Replies)
Discussion started by: boolean2222
6 Replies

4. Shell Programming and Scripting

Check a condition in cronjob to execute a sh file

Hi, I need to execute a crontab based on a condition where one SH file should be executed only based on the output of a file in a folder. I have written the following cron job which is not working. 00 01 * * * read a < /px/batch/reslut.txt && && sh /px/batch/check.sh where my... (2 Replies)
Discussion started by: shanth_chandra
2 Replies

5. Shell Programming and Scripting

how to find a file then overwrite with a newer version

This should be a simple script, but can't find one with google search. I just need to find the file that is in many directories, then overwrite that file with a newer version i.e. find file.jar then overwrite with /root/file.jar All I get in searches is substitute text with new test inside... (1 Reply)
Discussion started by: haircat
1 Replies

6. Shell Programming and Scripting

Condition to check whether configuration file is empty or not?

CMD=$(find "${Release_Container}" -iname "${Release_Name}"_Release.txt) for i in `cat $CMD` do if ];then cd ${Sandbox_dir} CMD1=$(find "${Sandbox_dir}"/* -iname "${Release_Name}" -type d | awk -F/ '{print $(NF)}' | head -1 ) if ];then echo -e "################### CHECKOUT START... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

7. Shell Programming and Scripting

Perl script, replace file with newer file

Hello, Can you please help me one this: I have two servers: Server A and server B. Every day on 03.00AM in only one on these two servers (randomly)is generated one file, lets say file.txt. I want to copy this file also to the other server. I want to create a perl script that does... (2 Replies)
Discussion started by: arrals_vl
2 Replies

8. Shell Programming and Scripting

Parse tab delimited file, check condition and delete row

I am fairly new to programming and trying to resolve this problem. I have the file like this. CHROM POS REF ALT 10_sample.bam 11_sample.bam 12_sample.bam 13_sample.bam 14_sample.bam 15_sample.bam 16_sample.bam tg93 77 T C T T T T T tg93 79 ... (4 Replies)
Discussion started by: empyrean
4 Replies

9. UNIX for Dummies Questions & Answers

Condition check using awk

Hi, I have a file in the following format "SYLVESTER,WILLARD G"|"S00633600"|"221052958A"|"H2256"|"015"|""|"00000042BASJ"|"665303"|"N"|"20100211"|"380.4"|""|""|""|"5400"|"20110218"|""|"20110218"|"FEESC"|"D"|"F"|"P" "PURINGTON-KELLEY,C"|"S00808783"|"029424717A"|"H2256"|"024"|"MEMBER JOINED... (3 Replies)
Discussion started by: nua7
3 Replies

10. Shell Programming and Scripting

Copy file only if newer

I only want the file copied if it is newer. But it still copies the file? zip -u Ubuntu_Documents.zip ./* cp -u Ubuntu_Documents.zip $DOCS_Backup/Ubuntu_Documents_`date +"%Y-%m-%d-%H-%M"`.zip (5 Replies)
Discussion started by: drew77
5 Replies
AutoSplit(3pm)						 Perl Programmers Reference Guide					    AutoSplit(3pm)

NAME
AutoSplit - split a package for autoloading SYNOPSIS
autosplit($file, $dir, $keep, $check, $modtime); autosplit_lib_modules(@modules); DESCRIPTION
This function will split up your program into files that the AutoLoader module can handle. It is used by both the standard perl libraries and by the MakeMaker utility, to automatically configure libraries for autoloading. The "autosplit" interface splits the specified file into a hierarchy rooted at the directory $dir. It creates directories as needed to reflect class hierarchy, and creates the file autosplit.ix. This file acts as both forward declaration of all package routines, and as timestamp for the last update of the hierarchy. The remaining three arguments to "autosplit" govern other options to the autosplitter. $keep If the third argument, $keep, is false, then any pre-existing "*.al" files in the autoload directory are removed if they are no longer part of the module (obsoleted functions). $keep defaults to 0. $check The fourth argument, $check, instructs "autosplit" to check the module currently being split to ensure that it includes a "use" specifi- cation for the AutoLoader module, and skips the module if AutoLoader is not detected. $check defaults to 1. $modtime Lastly, the $modtime argument specifies that "autosplit" is to check the modification time of the module against that of the "autosplit.ix" file, and only split the module if it is newer. $modtime defaults to 1. Typical use of AutoSplit in the perl MakeMaker utility is via the command-line with: perl -e 'use AutoSplit; autosplit($ARGV[0], $ARGV[1], 0, 1, 1)' Defined as a Make macro, it is invoked with file and directory arguments; "autosplit" will split the specified file into the specified directory and delete obsolete ".al" files, after checking first that the module does use the AutoLoader, and ensuring that the module is not already currently split in its current form (the modtime test). The "autosplit_lib_modules" form is used in the building of perl. It takes as input a list of files (modules) that are assumed to reside in a directory lib relative to the current directory. Each file is sent to the autosplitter one at a time, to be split into the directory lib/auto. In both usages of the autosplitter, only subroutines defined following the perl __END__ token are split out into separate files. Some rou- tines may be placed prior to this marker to force their immediate loading and parsing. Multiple packages As of version 1.01 of the AutoSplit module it is possible to have multiple packages within a single file. Both of the following cases are supported: package NAME; __END__ sub AAA { ... } package NAME::option1; sub BBB { ... } package NAME::option2; sub BBB { ... } package NAME; __END__ sub AAA { ... } sub NAME::option1::BBB { ... } sub NAME::option2::BBB { ... } DIAGNOSTICS
"AutoSplit" will inform the user if it is necessary to create the top-level directory specified in the invocation. It is preferred that the script or installation process that invokes "AutoSplit" have created the full directory path ahead of time. This warning may indicate that the module is being split into an incorrect path. "AutoSplit" will warn the user of all subroutines whose name causes potential file naming conflicts on machines with drastically limited (8 characters or less) file name length. Since the subroutine name is used as the file name, these warnings can aid in portability to such systems. Warnings are issued and the file skipped if "AutoSplit" cannot locate either the __END__ marker or a "package Name;"-style specification. "AutoSplit" will also emit general diagnostics for inability to create directories or files. perl v5.8.0 2002-06-01 AutoSplit(3pm)
All times are GMT -4. The time now is 06:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy