The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 11:16 AM
Help with Korn Shell script heprox AIX 1 12-19-2005 02:04 PM
korn shell script pavan_test UNIX Desktop for Dummies Questions & Answers 3 10-27-2005 12:09 PM
Multiple su - in Korn Shell script furrari Shell Programming and Scripting 2 07-30-2004 09:29 AM
su and password in a Korn shell script Melissa UNIX for Dummies Questions & Answers 2 10-03-2001 07:24 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-24-2005
pavan_test pavan_test is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 53
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
  #2 (permalink)  
Old 10-26-2005
RTM's Avatar
RTM RTM is offline Forum Advisor  
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0