02-15-2006
Admittedly I do not fully understand the problem but you can narrow your ls search from a '*' wildcard to specific numbers.
ls scrnslc_[0-9][0-9][0-9][0-9]
The ls command sorts alphabetically by default so if you're looking for the last file to move you can pipe the output of the above into a tail -1. The whole thing put together might look something like this:
mv `ls scrnslc_[0-9][0-9][0-9][0-9] | tail -1` scrnslc_out
If you want to save the scrnslc_#### files as they are, you could use the ln command in stead of mv.
I hope this is helpful.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
OK, I know next to nothing about scripting in unix, and at the moment I don't have access to a unix environment...
We have an application that generates a text report file which is later printed. The format is this:
bbtptcYYMMDDSSCC.txt (year/month/day/second/check digit)
I want a... (1 Reply)
Discussion started by: josborn777
1 Replies
2. Shell Programming and Scripting
Hi,
I have files coming in every day with that days timestamp like:
nameyyyymmddhhmmss.ext.
I need the most recent one and so i am using
cat `ls -t name*|head -1 ` > temp
i am sorting the files in the decending order and am copying the most recent one into a temp file.
It works at times... (3 Replies)
Discussion started by: anujairaj
3 Replies
3. Linux
I have only been working with Linux for a few years now so bear with my noob question. I was wondering if there is a way to tail the most recent file that has a file name like 'scrubsncoa%'. There will be at least 2 files in the directory that start with 'scrubsncoa' and a few other different... (2 Replies)
Discussion started by: RyanD
2 Replies
4. Shell Programming and Scripting
Hi people,
Please some help over here.
I have logs in a directory, in which I need to get the most recent file in order to put it within other command.
The format of the files are
loadfiles20090308094339_41
loadfiles20090308094418_42
loadfiles20090308095457_43... (4 Replies)
Discussion started by: cgkmal
4 Replies
5. Shell Programming and Scripting
Hi All,
I wish to get the most recent file from a dir which contains a specific string.
for example, in a dir sample/ , i have 3 files
file1.txt -- contains 'good'
file2.txt -- contains 'good'
file3.txt-- contans 'hello'
I want to search for the recent file (that is file2.txt) which... (3 Replies)
Discussion started by: little_wonder
3 Replies
6. UNIX for Dummies Questions & Answers
Hi,
Here is my problem:
I try to write a script to find data in a file named "data" for exemple.
Let's say I am in the directory /x/y/z, there are several sub-directories in the "z" directory (each sub-directory has a file "data") and I am searching for the word "help".
So I use this... (9 Replies)
Discussion started by: StephB
9 Replies
7. Shell Programming and Scripting
Hi guys,
Under my root directory there are many sub-directories which contains log file for every day of running.
How can I find , in one command only, the recent log file in each sub-directory?
For example, If I run the following:
find . -name "exp_prod_*_*_yes_*_.log" -exec ls -ltr {} \;... (12 Replies)
Discussion started by: nir_s
12 Replies
8. Solaris
Dear,
Require a script to check :
If the file under /opt/OV/log directory has recent 5 hours(or user defined value) file generated or not
If generated then cmd to call :
opcmsg a=a o=o msg_grp=OpC msg_text="Log file didn't generated on $time" s=critical (1 Reply)
Discussion started by: mjoshi87
1 Replies
9. Shell Programming and Scripting
Hello Experts...
dir of FTP will list all the files in the directory. Is there any command or option of dir that will give me the most recent file only?
Since I couldn't find any such thing, I thought of creating a log file (of FTP results) and work on this log file to determine the most recent... (2 Replies)
Discussion started by: juzz4fun
2 Replies
10. Shell Programming and Scripting
Hi,
I need to find the most recent files by their name from an X repertoire.
The problem is that the name of the files is of type:
POWERL10_20151203000.xml
POWERL10_20151203001.xml
POWERL10_20151202000.xml
FIXED VALUE_DATENNN.xml
NNN = Sequential number
I would need to recover the... (4 Replies)
Discussion started by: verita
4 Replies
LEARN ABOUT OPENSOLARIS
nischttl
nischttl(1) User Commands nischttl(1)
NAME
nischttl - change the time to live value of a NIS+ object
SYNOPSIS
nischttl [-AfLP] time name...
DESCRIPTION
nischttl changes the time to live value (ttl) of the NIS+ objects or entries specified by name to time. Entries are specified using indexed
names (see nismatch(1)).
The time to live value is used by object caches to expire objects within their cache. When an object is read into the cache, this value is
added to the current time in seconds yielding the time when the cached object would expire. The object may be returned from the cache until
the current time is earlier than the calculated expiration time. When the expiration time has been reached, the object will be flushed
from the cache.
The time to live time may be specified in seconds or in days, hours, minutes, seconds format. The latter format uses a suffix letter of d,
h, m, or s to identify the units of time. See the examples below for usage.
The command will fail if the master NIS+ server is not running.
Setting a high ttl value allows objects to stay persistent in caches for a longer period of time and can improve performance. However,
when an object changes, in the worst case, the number of seconds in this attribute must pass before that change is visible to all clients.
Setting a ttl value of 0 means that the object should not be cached at all.
A high ttl value is a week, a low value is less than a minute. Password entries should have ttl values of about 12 hours (easily allows
one password change per day), entries in the RPC table can have ttl values of several weeks (this information is effectively unchanging).
Only directory and group objects are cached in this implementation.
OPTIONS
The following options are supported:
-A Modify all tables in the concatenation path that match the search criterion specified in name. This option implies the -P switch.
-f Force the operation and fail silently if it does not succeed.
-L Follow links and change the time to live of the linked object or entries rather than the time to live of the link itself.
-P Follow the concatenation path within a named table. This option only makes sense when either name is an indexed name or the -L switch
is also specified and the named object is a link pointing to entries.
EXAMPLES
Example 1 Changing the ttl of an Object
The following example shows how to change the ttl of an object using the seconds format and the days, hours, minutes, seconds format. The
ttl of the second object is set to 1 day and 12 hours.
example% nischttl 184000 object
example% nischttl 1d12h object
Example 2 Changing the ttl for a password Entry
This example shows how to change the ttl for a password entry.
example% nischttl 1h30m '[uid=99],passwd.org_dir'
Example 3 Changing the ttl of Entries Pointed to by a Link
The next two examples change the ttl of the object or entries pointed to by a link, and the ttl of all entries in the hobbies table.
example% nischttl -L 12h linkname
example% nischttl 3600 '[],hobbies'
ENVIRONMENT VARIABLES
NIS_PATH If this variable is set, and the NIS+ name is not fully qualified, each directory specified will be searched until the object
is found. See nisdefaults(1).
EXIT STATUS
The following exit values are returned:
0 Successful operation.
1 Operation failed.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWnisu |
+-----------------------------+-----------------------------+
SEE ALSO
NIS+(1), nischgrp(1), nischmod(1), nischown(1), nisdefaults(1), nismatch(1), nis_objects(3NSL), attributes(5)
NOTES
NIS+ might not be supported in future releases of the Solaris operating system. Tools to aid the migration from NIS+ to LDAP are available
in the current Solaris release. For more information, visit http://www.sun.com/directory/nisplus/transition.html.
SunOS 5.11 2 Dec 2005 nischttl(1)