08-14-2006
find file with date and recursive search for a text
Hey Guyz I have a requirement something like this..
a part of file name, date of modification of that file and a text is entered as input.
like
Date : 080206 (MMDDYY format.)
filename : hotel_rates
text : Jim
now the file hotel_rates.ZZZ.123 (creation date is Aug 02 2006) should be found first and then the file should be opened in a read olny mode pointing to the first occurance of text 'Jim' in that file. when we press 'n' the next occurance of Jim should be visible and so on until the EOF. once searching Jim is done when we press q the control should be back to program.
all the files will be located in an archive folder with name /archive
and there'll be files with different dates like
hote_rates.XXX.333 Aug 01 2006
hotel_rates.YYY.222 Jul 30 2006
hotel_rates.ZZZ.123 Aug 02 2006
logistic_rates.ZZZ.123
logistic_rates.SSS.134
Now for the above example the file hotel_rates.ZZZ.123 should be found and it should be pinting to first occurance of Jim in that file after the user enters the input and hits enter.
Let me know if I made myself clear here..
Thanks,
Ronnie
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a text file, foo.txt, it looks something like below. In the file there is a line that gives the date in the form of: Mon Jun 15 11:09:31 2008. I need to find which date is the newest and then store certain details of that list data to another file. So, in this sample text file, I... (6 Replies)
Discussion started by: boolean2222
6 Replies
2. Shell Programming and Scripting
Hi all,
I need to get the latest file. I have found this command "ls -lrt" that is great but not recursive.
Can anyone help?
Thanx by advance. (7 Replies)
Discussion started by: 1or2is3
7 Replies
3. UNIX for Advanced & Expert Users
I was working on a shell script and found that the find command took too long, especially when I had to execute it multiple times. After some thought and research I came up with two functions.
fileScan()
filescan will cd into a directory and perform any operations you would like from within... (8 Replies)
Discussion started by: newreverie
8 Replies
4. Shell Programming and Scripting
Hi All,
I am very new to UNIX and I have tried this for a longtime now and unable to crack it....
There is a file that is continuously updating. I need to search for the string and find the date @ which it updated every day.....
eg:
String is "work started"
The log entry is as below:
... (1 Reply)
Discussion started by: Nithz
1 Replies
5. Shell Programming and Scripting
Hi All,
This is the first time I have posted to this forum so please bear with me. Thanks also advance for any help or guidance.
For a project I need to do the following.
1. There are multiple files in multiple locations so I need to find them and the location. So I had planned to use... (9 Replies)
Discussion started by: Charlie6742
9 Replies
6. UNIX for Dummies Questions & Answers
Is there a way to use the find command to recursively scan directories for files greater than 1Gb in size and print out the directory path and file name only?
Thanks in advance. (6 Replies)
Discussion started by: jimbojames
6 Replies
7. Shell Programming and Scripting
Hi,
Need some help...
I want to execute sequence commands, like below
test1.sh
test2.sh
...etc
test1.sh file will generate log file, we need to search for 'complete' string on test1.sh file, once that condition success and then it should go to test2.sh file, each .sh scripts will take... (5 Replies)
Discussion started by: rkrish123
5 Replies
8. UNIX for Dummies Questions & Answers
Hi All
I have a requirement to find the file that are most latest to be modified in each directory. Can somebody help with the command please?
E.g of the problem.
The directory A is having sub directory which are having subdirectory an so on.
I need a command which will find the... (2 Replies)
Discussion started by: sudeep.id
2 Replies
9. Shell Programming and Scripting
I'm trying to find folders created by a propritary data aquisition software with the .aps ending--yes, I have never encountered folder with a suffix before (some files also end in .aps) and sort them by date. I need the whole path
ls -dt "$dataDir"*".aps"does exactly what I want except for the... (2 Replies)
Discussion started by: Michael Stora
2 Replies
10. Shell Programming and Scripting
Hi guys,
I have a text file named file1.txt that is formatted like this:
001 , ID , 20000
002 , Name , Brandon
003 , Phone_Number , 616-234-1999
004 , SSNumber , 234-23-234
005 , Model , Toyota
007 , Engine ,V8
008 , GPS , OFF
and I have file2.txt formatted like this:
... (2 Replies)
Discussion started by: An0mander
2 Replies
LEARN ABOUT PHP
macunpack
MACUNPACK(1) General Commands Manual MACUNPACK(1)
NAME
macunpack - Macintosh file de-archiver
SYNOPSIS
macunpack [ - options ] [ file ]
DESCRIPTION
macunpack takes the Macintosh MacBinary archive specified in file (or standard input if none is specified) and extracts the files it con-
tains subject to the options specified. The program will also accept the data fork of the archive for some kinds of archive as standard
input.
OPTIONS
In the absence of any options, macunpack takes the specified archive and silently extracts the file(s) it contains into MacBinary format,
giving the output files ".bin" extensions and placing them in the current working directory. Subdirectories are created for embedded fold-
ers.
-3 Write files in fork format (.info, .data and .rsrc files.)
-f As -3, but empty data and rsrc files are not created.
-r Write resource forks only (.rsrc files.)
-d Write data forks only (.data files.)
-u As -d, but the codes for CR and LF are interchanged, the filename extension is .text.
-U As -u, but there is no filename extension.
-a Write files in AppleShare format. This option is only valid if the program is compiled with support for some form of AppleShare.
The current directory must be a valid AppleShare folder.
-s Write extracted files to standard output in MacBinary format.
-l List every file extracted (and every directory/folder created etc.)
-v Like -l, but more verbose (implies -l.)
-i Do not extract, give information only (implies -l.)
-q Ask the user for every file/folder whether it should be extracted (implies -l.)
-V Gives the patchlevel of the program, and other information. Other options are ignored and the program quits immediately.
-H Give short information about the options. Other options are ignored and the program quits immediately.
BUGS
As this is a beta release, there may still be some problems. Archives that are password protected and multi-file archives are not dealt
with.
SEE ALSO
macutil(1)
AUTHOR
Dik T. Winter, CWI, Amsterdam, The Netherlands (dik@cwi.nl)
Parts of the code are based on codes from: Steve Davies, Rahul Dhesi, Casper H.S. Dik, Jim McKie, Mark G. Mendel, Haruhiko Okumura, Joe
Orost, Samuel H. Smith, Yooichi Tagawa, Spencer W. Thomas, Ken Turkowski, Allan G. Weber, James A. Woods and Haruyasu Yoshizaki.
3rd Berkeley Distribution October 22, 1992 MACUNPACK(1)