The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
substr() thru awk Korn Shell Script sbryant Shell Programming and Scripting 4 01-24-2008 07:16 AM
Help with Korn Shell script heprox AIX 1 12-19-2005 10:04 AM
korn shell script pavan_test UNIX Desktop for Dummies Questions & Answers 3 10-27-2005 09:09 AM
Multiple su - in Korn Shell script furrari Shell Programming and Scripting 2 07-30-2004 06:29 AM
su and password in a Korn shell script Melissa UNIX for Dummies Questions & Answers 2 10-03-2001 04:24 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-24-2005
Member
 

Join Date: Oct 2005
Posts: 44
korn shell script

hello.,

i have 2 files..

1 file is in this folder

/home/test/ssk/DSA.WLG.20050713211544.20050710.20050713211544
(this part)

other file is in this folder

/home/kk/dev/DSA.WLG.20050711210100.20050710.20050711210100
(this part)

i have to compare both the files using "20050713211544" ( THIS PART)and "20050711210100"
and then which ever is greatest i have to move that entire file only
to the following folder : /home/pav/testdata


i have to write the above in a ksh script.

can anyone help me please !!!

Thanks
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-26-2005
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Code:
#!/bin/ksh
file1="/home/test/ssk/DSA.WLG.20050713211544.20050710.20050713211544"
file2="/home/kk/dev/DSA.WLG.20050711210100.20050710.20050711210100"
file1date=`echo $file1|awk -F. '{print $3}'`
file2date=`echo $file2|awk -F. '{print $3}'`
if [ $file1date -lt $file2date ]
then
     echo "Put code here to move $file2"
else
     echo "Put code here to move $file1"
fi
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0