prob's with while loop

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers prob's with while loop
# 1  
Old 01-11-2008
prob's with while loop

Hi Gurus,

I have a requirement where I have files in a folder
For example in home/input i have files

Actually i will get the files as abc.xml , i rename & put it with timestamp.

Now i am using a while loop i should check for xmls without timestamp & continue the while loop

i.e., whenever i get a new file suppose abc4.xml, i should run the while loop

Please help me out with sample code
# 2  
Old 01-11-2008
If you mean to find those files not timestamped:
for file in `ls abc*.xml`
        timestamp=$(date "+%Y%m%d.%H.%M.%S_")
        mv $file $timestamp"$file"   

IF that's what you mean - test this before you run it on real files.
# 3  
Old 01-11-2008
Thanks for reply

Actually in my requirement i had only appended timestamps to the original file.The abc*.xml is an example .
The file name will not be abc...
it may be fff or fahsad any random name.

My idea is just to find the file names which are not starting with 2008 because i am putting timestamp before the file name.

How to get filenames starting with 2008 & put in while loop

while(filename!= 2008)

Can u please help me out with sample code
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] For Loop with 2 commands? (hostname prob)

Hi I would like to ssh into serveral servers, print the hostname and do an ls (of files in a certain directory), and add these details to a file. so i have this: #!/usr/bin/bash for host in hostnames_here do ssh $host echo "$HOSTNAME" ls /directory_location > ~/new_file_name.txt ... (6 Replies)
Discussion started by: horhif
6 Replies

2. Programming

c++ string prob

hi could some body help me? im making a program that writes in a file.txt how can i compare my "char x" to another char? #include<iostream> #include<fstream> #include<string.h> using namespace std; int main() { char x; char y; cout << "enter title" << endl; (0 Replies)
Discussion started by: rave03
0 Replies

3. Windows & DOS: Issues & Discussions

Prob. with using as86

Hi, I have downloaded as86-0.16.17.tar file. When I umcompressed it I found it consisting of C source and header files. How can i create an executable for compiling assembly programs. Kindly help me with this. I am working on windows XP professional and system is HP DX 2700. Zulfi. (0 Replies)
Discussion started by: zak100
0 Replies

4. Solaris

Solaris 8 prob

Pls tell me how can i recover adeleted user in solaris 8. Please help me I'm a newby thanks aamer (4 Replies)
Discussion started by: aamer
4 Replies

5. Solaris

mount prob

# mount /dev/dsk/c1d1s1 /mnt mount: /dev/dsk/c1d1s1 is not this fstype I tried to mount the above raw patition and it gave an error. but can someone help (3 Replies)
Discussion started by: seyiisq
3 Replies

6. Shell Programming and Scripting

sorting prob

my sample is 01012007 01022007 02022007 01032007 20022007 02032007 01092007 05022007 30022007 which is date in ddmmccyy format i try to sort like this sort -n +0.2 -0.5 +0.0 -0.3 file but the results are not correct pls help...... (3 Replies)
Discussion started by: paresh n doshi
3 Replies

7. UNIX for Advanced & Expert Users

NFS prob

Hi all, i want mount directory with permission #NFS Server = FreeBSD /etc/export = /data -alldirs -network -mask #NFS Client = Ubuntu /dir nfs intr but i m unable to create folder in /dir whts the wrong? Please... (4 Replies)
Discussion started by: jagnikam
4 Replies

8. Shell Programming and Scripting

Sorting prob

Hi I have a directory having following three set of files as follows: test.20060804 test.20060801 test.20060802 I want to list the latest file which is less than 20060803. in this case, it will be test.20060802. How can i achieve the same? Any pointers to above will be appreciated. ... (7 Replies)
Discussion started by: Vikas Sood
7 Replies

9. AIX

memory prob

There is problem in my system whenever i run a command lsattr -El mem0 it shows 3gb memory and when i run lscfg -vp | grep Size it shows 8 modules of 512 mb. it means it shows 4 gb how is it possible. (1 Reply)
Discussion started by: vjm
1 Replies

10. Shell Programming and Scripting


When i am trying to $uncompress tress.dmp.Z I am getting tress.dmp.Z permission denied. What action i have to perform to unzip or uncompress It has rw-r--r-- permissions When i am trying to change the permissions chmod 744 it says. chmod: Warning: can't change tress.dmp.Z Just... (1 Reply)
Discussion started by: dreams5617
1 Replies
Login or Register to Ask a Question