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 > Operating Systems > HP-UX
.
google unix.com



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How can i copy files by date last modifed range? geauxsaints UNIX for Advanced & Expert Users 4 05-25-2008 11:06 AM
Sorting Files by date and moving files in date order rebel64 Shell Programming and Scripting 2 03-11-2008 12:45 PM
To copy the files newer than specific date RAJESHKANNA SUN Solaris 3 08-07-2007 03:44 AM
script to rename files with current date and copy it. logic0 UNIX for Dummies Questions & Answers 6 05-01-2007 05:13 AM
How to copy a file according to the date Nayanajith Shell Programming and Scripting 1 06-21-2006 03:46 AM

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 03-10-2006
isingh786 isingh786 is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 75
copy files with date

Hi,

I have a coupel of files in /tmp which I have to copy to /var. But I want their name to be same as the source with date suffix.

But the problem is I don;t know the prefix of the file, I only know the suffix of file.

AAA.997
ABC.997
ADC.997

The later part 997 is constant but the former part can be anything.

Is there any way that while making copy, I can find the prefix of file and then copy to /var as AAA.997.0310061430.

Thanks,
Inder
  #2 (permalink)  
Old 03-10-2006
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Code:
#!/bin/ksh

a='AAA.997'

prefix="${a%%.*}"
suffix="${a##*.}"

echo "a->[${a}] prefix->[${prefix}] suffix->[${suffix}]"
Sponsored Links
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:21 AM.


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