Suggest me the easiest method


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Suggest me the easiest method
# 1  
Old 08-11-2006
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
# 2  
Old 08-11-2006
$ ls | grep "myfile_[0-9]\{8\}_[0-9]\{6\}\.txt"
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Easiest way to comment/uncomment a shell script?

cd path line1 line2 line3 line4 line5 Lets say thats the sample script...So say if i have to comment the above script, which would be the better way so that whenever i want, i cud comment or uncomment the same. Thanks (1 Reply)
Discussion started by: saggiboy10
1 Replies

2. Solaris

svc:/network/physical:default: Method "/lib/svc/method/net-physical" failed with exit status 96. [ n

After a memory upgrade all network interfaces are misconfigued. How do i resolve this issue. Below are some out puts.thanks. ifconfig: plumb: SIOCLIFADDIF: eg000g0:2: no such interface # ifconfig eg1000g0:2 plumb ifconfig: plumb: SIOCLIFADDIF: eg1000g0:2: no such interface # ifconfig... (2 Replies)
Discussion started by: andersonedouard
2 Replies

3. Ubuntu

What is the easiest way to install Ubuntu?

I am planning to dual boot Windows XP and Ubuntu 9.04, I have already burned Ubuntu into a CD and have also downloaded the ISO. But when I go to My Computer to start the installation, a different icon appears. And when I open it with ISO Buster, it opens up separately. I'm confused on what to... (5 Replies)
Discussion started by: Anna Hussie
5 Replies

4. Shell Programming and Scripting

the easiest way to break down this column?

i have a one column txt file, which has a large amount of data which look like this a 11 3 b 45 77 r 7 9 blah blah blah what i am trying to do here is for every 3 lines, i want to move the 2nd and 3rd line to the first line, so it will look like this a 11 3 b 45 77 r 7 9 (8 Replies)
Discussion started by: fedora
8 Replies

5. Shell Programming and Scripting

Easiest way 2 convert the time YYYY-MM-DD HH:MM:SS.subsec to MJD - gAWK?

What is the easiest way to convert the time (Gregorian YYYY-MM-DD HH:MM:SS.subseconds) to MJD (Modified Julian time) inside a text file: 2010-06-28 15:11:08.0902173 otherstuff 2010-06-28 15:12:09.3452183 otherstuff ... to 55375 54668.0902173 otherstuff 55375 54729.3452183 otherstuff... (2 Replies)
Discussion started by: menon
2 Replies

6. UNIX for Dummies Questions & Answers

Which Certification Is Easiest/Quickest?

I need to gain one of these fast!... Any ideas on best way to go about it?...I have money to spend but not sure how to do it. Solaris certification (SUN Admin Part 1 and/or Part 2) as well as proficiency in AIX OR AIX certification (ASA and/or ASP) as well as proficiency in Solaris, (1 Reply)
Discussion started by: IBMPBC
1 Replies

7. OS X (Apple)

What's The Easiest Route To Creating A Unix Executable File for Terminal?

I've seen the executable open in the application OmniOutliner, can I create an executable with this app? I'd like to be able to create the unix executable and insert it into terminal, but I'm not sure if the Omni app will allow me to create it. Any one have any ideas or possibly familiar with... (10 Replies)
Discussion started by: unimachead
10 Replies

8. Shell Programming and Scripting

Easiest way to send output to a debug file?

I have this in my script: DEBUG_DIR=/log/rotate_output DEBUGLOG=${DEBUG_DIR}/rotate.${TIMESTAMP} SERVER_FILE_LIST="\ wasint0206 /logs/squid_backup wasint0201 /logs/squid_backup" /usr/bin/echo "${SERVER_FILE_LIST}" | while read SERVER DIRECTORY do cd /log/squid_logs/${SERVER}... (2 Replies)
Discussion started by: LordJezo
2 Replies

9. UNIX for Dummies Questions & Answers

Easiest and best scripting book ?

Hello, I am in need of a easy to read and easy to understand, Unix scripting book. Can anyone make any recommendations ? thanks in advance simon2000 (2 Replies)
Discussion started by: simon2000
2 Replies
Login or Register to Ask a Question