The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
What's The Easiest Route To Creating A Unix Executable File for Terminal? unimachead OS X (Apple) 9 04-30-2008 07:02 AM
Two SQL connections..suggest changes. bhagat.singh-j Shell Programming and Scripting 0 10-24-2006 11:21 PM
Easiest way to send output to a debug file? LordJezo Shell Programming and Scripting 2 02-17-2006 06:00 AM
What's the easiest way to display system cpu, memory, # drives/size ?? eyounes UNIX for Advanced & Expert Users 4 03-12-2002 04:31 AM
Easiest and best scripting book ? simon2000 UNIX for Dummies Questions & Answers 2 02-13-2002 06:45 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-11-2006
Registered User
 

Join Date: May 2005
Posts: 49
Suggest me the easiest method

Hi,
I want to check whether a file of the format myfile_YYYYMMDD_HHMMSS.txt exists in a particular directory. Here YYYYMMDD_HHMMSS is the time stamp, so it will be numbers always [ I want to check for numbers only, no need to check whether valid time , if it is well and good ].
What is the best method to do this
I did it like this :
ls myfile_[0-9]*_[0-9]*.txt
but it will list files like myfile_YYYYDD_HH.txt etc

Regards
Shihab
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-11-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 356
$ ls | grep "myfile_[0-9]\{8\}_[0-9]\{6\}\.txt"
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:54 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