Capture listed files from find command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Capture listed files from find command
# 1  
Old 01-17-2013
Capture listed files from find command

Hi all,

I am using command
Code:
find $InputPath -type f -mtime +30

However, I need to capture the file listed in screen.
May I know how to achieve this?


Thank you.
# 2  
Old 01-17-2013
Use redirection (man shell) and/or tee cmd.
# 3  
Old 01-17-2013
Hi,

Is this the correct syntax?

Code:
echo [`date +"%Y-%m-%d %T"`] "---------------" | tee -a $LogPath/$LogFile
find $InputPath -type f -mtime +30 | tee -a $LogPath/$LogFile
echo [`date +"%Y-%m-%d %T"`] "---------------" | tee -a $LogPath/$LogFile

But I need the date in front of the files.


Please advise.

Last edited by ashly; 01-17-2013 at 05:06 AM..
# 4  
Old 01-17-2013
This is not what you requested in your first post. Pls show us our desired output.
# 5  
Old 01-17-2013
Hi,

Current output as below:
PHP Code:
[2013-01-17 16:53:02]---------------
filename1
filename2
[2013-01-17 16:53:02]--------------- 
Desirable output:
PHP Code:
[2013-01-17 16:53:02]---------------
[
2013-01-17 16:53:02]filename1
[2013-01-17 16:53:02]filename2
[2013-01-17 16:53:02]--------------- 
# 6  
Old 01-17-2013
Quote:
Originally Posted by ashly
Hi,

Is this the correct syntax?

Code:
echo [`date +"%Y-%m-%d %T"`] "---------------" | tee -a $LogPath/$LogFile
find $InputPath -type f -mtime +30 | sed "s/^/'[`date +"%Y-%m-%d %T"`]/" | tee -a $LogPath/$LogFile
echo [`date +"%Y-%m-%d %T"`] "---------------" | tee -a $LogPath/$LogFile

But I need the date in front of the files.


Please advise.
Try the above highlighted!!!

Cheers,
RangaSmilie
# 7  
Old 01-17-2013
Quote:
Originally Posted by rangarasan
Try the above highlighted!!!

Cheers,
RangaSmilie
Hi Ranga,

I tried but I got the error below:
PHP Code:
sed0602-404 Function s/^/'[2013-01-17 cannot be parsed. 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete files listed in text file

Hi Team, Here's the scenario, I have a text file called "file_list.txt". Its content is as follows. 111.tmp 112.tmp 113.tmp 114.tmp These files will present in "workdir" directory. It has many files. But only the files present in file_list.txt has to be deleted from the workdir... (7 Replies)
Discussion started by: kmanivan82
7 Replies

2. Shell Programming and Scripting

Total number of files in the folder should be listed

Hi All, When i give the ls -lrt to list out all files with total number of files , i get the output as ls -lrt total 72 -rw-r--r-- 1 hari staff 796 Jul 11 09:17 va.txt -rw-r--r-- 1 hari staff 169 Jul 13 00:20 a.log -rwxr-xr-x 1 hari staff 659 Aug... (9 Replies)
Discussion started by: Kalaihari
9 Replies

3. Shell Programming and Scripting

Copy files listed in text file to new directory

I am trying to write a script that will copy all file listed in a text file (100s of file names) to a new directory Assume script will run with main as current working directory and I know how many files/lines will be in List.txt Im trying to work up a test script using this model Contents of... (2 Replies)
Discussion started by: IAmTheGrass
2 Replies

4. Shell Programming and Scripting

How to read a file name that was recently edited when listed using ls command?

I was trying to write a script that will process recently creatd file. From below, the script should process input_20111230.dat file. sam:/top/work/data/input: ls -ltr input_*.dat -rw-rw-rw- 1 work edprod 455668 Dec 24 09:16 input_20111224.dat -rw-r--r-- 1 work edprod ... (7 Replies)
Discussion started by: siteregsam
7 Replies

5. Shell Programming and Scripting

Files copying - [ Listed files alone. ] - Shell script

Hi All, I am doing this for svn patch making. I got the list of files to make the patch. I have the list in a file with path of all the files. To Do From Directory : /myproject/MainDir To Directory : /myproject/data List of files need to copy is in the file: /myproject/filesList.txt ... (4 Replies)
Discussion started by: linuxadmin
4 Replies

6. Shell Programming and Scripting

Cut the first column in listed files

1.give the command wc -l *e* > create2.txt 2.now create2.txt contains a.txt b.txt c.txt d.txt 3.create2.txt is a random file ( output may vary depends on time) (eg: a1.txt , b1.txt,c1.txt,d1.txt if time changes) 4. now i want to cut the first colum from all the files mentioned in... (12 Replies)
Discussion started by: adaleru
12 Replies

7. Shell Programming and Scripting

Cut the first column in listed files > PERL script

Hi All, Using this command wc -l *e* > create2.txt i'm getting the following output >>>create2.txt listed output files, my requirement is how to cut the first coloum in all the files mentioned in create2.txt in perl. 50 allignment.pl 3 create.txt 4 application.txt ... (8 Replies)
Discussion started by: adaleru
8 Replies

8. Shell Programming and Scripting

Copy files listed in a text file - whitespace problem.

Hi, Say I have this text file <copy.out> that contains a list of files/directories to be copied out to a different location. $ more copy.out dir1/file1 dir1/file2 dir1/file3 "dir1/white space" dir1/file4 If I do the following: $copy=`more copy.out` $echo $copy dir1/file1... (4 Replies)
Discussion started by: 60doses
4 Replies

9. Shell Programming and Scripting

Little bit weired : Find files in UNIX w/o using find or where command

Yes , I have to find a file in unix without using any find or where commands.Any pointers for the same would be very helpful as i am beginner in shell scritping and need a solution for the same. Thanks in advance. Regards Jatin Jain (10 Replies)
Discussion started by: jatin.jain
10 Replies

10. HP-UX

CVSWeb - Directories listed but files not listed

I am using CVSWeb on HPUnix. When i access it, all directories are listed but files are not listed. I am getting the error "NOTE: There are 51 files, but none matches the current tag. " in tomcat sevrer log i am getting the message "rlog warning: Missing revision or branch number after -r"... (0 Replies)
Discussion started by: ganesh
0 Replies
Login or Register to Ask a Question