06-03-2005
A find and sort challenge...
Hi,
I need to generate a listing of files that have been changed since x day. the listing is to be sorted by date.
I managed to get the 1st requirement using the find command :
find . -mtime -100 -type f -ls
but I don't know how to sort the ls listing by date.
The challenge comes when the files that have been changed for a day lies all over the directory.
Can anyone help ?
A zillion thanks !
Poh
p/s: I'm on Tru64 UNIX; and sort -M is not available...
Last edited by ppohz; 06-03-2005 at 05:50 AM..
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi--
Ok. I have now found that:
find -x -ls
will do what I need as far as finding all files on a particular volume. Now I need to sort the results by the file's modification date/time.
Is there a way to do that?
Also, I notice that for many files, whereas the man for find says ls is... (8 Replies)
Discussion started by: groundlevel
8 Replies
2. Shell Programming and Scripting
Perl file::find can I sort the out put
I am using file::find in my script but how I wish to process each file found in date order.
Can I sort this module?
eg
part of current script is....
use File::Find;
# Recursively find all files and directories in $mqueue_directory
find(\&wanted,... (2 Replies)
Discussion started by: Andrek
2 Replies
3. UNIX for Dummies Questions & Answers
Hi - are there sort options with the find command? I don't see any in man. I have a script that is looping through a set a files to be processed and I need to process them in date timestamp order. tia
for file in `find ${LANDING_FILE_DIR}${BTIME_FILENAME_PATTERN1}`
do....
... (6 Replies)
Discussion started by: mavsman
6 Replies
4. Linux
Hi,
I need to look for a config file (ldap.conf) and pick the latest modified file.
`locate` tells me there are many ldap.conf's, some in /etc, /usr, /home, etc.
Is there some way I can sort them by last modified time via bash?
I was thinking maybe I could pipe the output of `locate` to `ls... (4 Replies)
Discussion started by: Housni
4 Replies
5. Shell Programming and Scripting
HI
Find command is sorting differently in different machines.
I am trying a script to find file with -name option and delete the files other and keep the latest. the problem I am facing is in one machine find command is returning output sorted with oldest first and latest . But in another... (1 Reply)
Discussion started by: ningy
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have a problem with a shell script.
The script should find all .cpp and .h files and list them.
With:
for file in `find $src -name '*.h' -o -name '*.cpp'
it gives out this:
H:\FileList\A\E\F\G\newCppFile.cpp
H:\FileList\header01.h
H:\FileList\B\nextCppFile.cpp
... (4 Replies)
Discussion started by: shellBeginner75
4 Replies
7. Shell Programming and Scripting
Hi,
I have two text files
file 1 with N lines
AAAAA 2.092290E-12
BBBBB 1.727740E-07
CCCCC 9.608710E-17
DDDDD 0.000000E+00
EEEEE 0.000000E+00
FFFFF 0.000000E+00
GGGGG 0.000000E+00
HHHHH 0.000000E+00
IIIII 3.300320E-04
...
The text in the first column is unique for each row and... (4 Replies)
Discussion started by: f_o_555
4 Replies
8. Shell Programming and Scripting
Used below command to get list of files sorted by timestamp
find -L . -type f -name '*dat*' | xargs ls -ltrg
I want to get only the filenames so I tried adding basename but it doenst work , can some one advise on how to get only file name (1 Reply)
Discussion started by: lalitpct
1 Replies
9. UNIX for Beginners Questions & Answers
I want to find all jpg files and then sort them by modification date. This is where I started.
find . -type f -name "*.jpg"
I tried to pipe a sort in there but that did not seem to work. Do I need to use xargs? (10 Replies)
Discussion started by: cokedude
10 Replies
HLS(1) General Commands Manual HLS(1)
NAME
hls - list files in an HFS directory
SYNOPSIS
hls [options] [hfs-path ...]
DESCRIPTION
hls lists files and directories contained in an HFS volume. If one or more arguments are given, each specified file or directory is shown;
otherwise, the contents of the current working directory are shown.
OPTIONS
-1 Output is formatted such that each entry appears on a single line. This is the default when stdout is not a terminal.
-a All files and directories are shown, including "invisible" files, as would be perceived by the Macintosh Finder. Normally invisible
files are omitted from directory listings.
-b Special characters are displayed in an escaped backslash notation. Normally special or non-printable characters in filenames are
replaced by a question mark (?).
-c Sort and display entries by their creation date, rather than their modification date.
-d List directory entries themselves rather than their contents. Normally the contents are shown for named directories on the command-
line.
-f Do not sort directory contents; list them in the order they appear in the directory. This option effectively enables -a and -U and
disables -l, -s, and -t.
-i Show the catalog IDs for each entry. Every file and directory on an HFS volume has a unique catalog ID.
-l Display entries in long format. This format shows the entry type ("d" for directory or "f" for file), flags ("i" for invisible),
file type and creator (four-character strings for files only), size (number of directory sub-contents or file resource and data
bytes, respectively), date of last modification (or creation, with -c flag), and pathname. Macintosh "locked" files are indicated by
"F" in place of "f".
-m Display entries in a continuous format separated by commas.
-q Replace special and non-printable characters in displayed filenames with question marks (?). This is the default when stdout is con-
nected to a terminal.
-r Sort entries in reverse order before displaying.
-s Show the file size for each entry in 1K block units. The size includes blocks used for both data and resource forks.
-t Sort and display entries by time. Normally files will be sorted by name. This option uses the last modification date to sort unless
-c is also specified.
-x Display entries in column format like -C, but sorted horizontally into rows rather than columns.
-w width
Format output lines suitable for display in the given width. Normally the width will be determined from your terminal, from the
environment variable COLUMNS, or from a default value of 80.
-C Display entries in column format with entries sorted vertically. This is the default output format when stdout is connected to a
terminal.
-F Cause certain output filenames to be followed by a single-character flag indicating the nature of the entry; directories are fol-
lowed by a colon (:) and executable Macintosh applications are followed by an asterisk (*).
-N Cause all filenames to be output verbatim without any escaping or question-mark substitution.
-Q Cause all filenames to be enclosed within double-quotes (") and special/non-printable characters to be properly escaped.
-R For each directory that is encountered in a listing, recursively descend into and display its contents.
-S Sort and display entries by size. For files, the combined resource and data lengths are used to compute a file's size.
-U Do not sort directory contents; list them in the order they appear in the directory. On HFS volumes, this is usually an alphabetical
case-insensitive ordering, although there are some idiosyncrasies to the Macintosh implementation of ordering. This option does not
affect -a, -l, or -s.
SEE ALSO
hfsutils(1), hcd(1), hpwd(1), hdir(1), hcopy(1)
FILES
$HOME/.hcwd
AUTHOR
Robert Leslie <rob@mars.org>
HFSUTILS
14-Jan-1997 HLS(1)