Sponsored Content
Full Discussion: Retaining latest file
Top Forums Shell Programming and Scripting Retaining latest file Post 302901843 by anil029 on Friday 16th of May 2014 02:56:42 AM
Old 05-16-2014
Hi,
The file does not necesaarily have these names (anil_111 and anil_222). The first name 'anil' would come in parameter and remaining after '_' is timestamp.
I basically have to write a script which will list files starting with 'anil' (as in this case) and remove the older one and retain the latest one.

I hope i made it clear now. Please advice.

Thanks,
Anil
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Retaining timestamp on copy of a file

While copying, how we can retain the same date for new file as it was on the old file. (1 Reply)
Discussion started by: param_it
1 Replies

2. Shell Programming and Scripting

retaining file path

hi all, Is there any way to retain file path? echo "Please enter your old filename" read a #user input : /blah/blah1 echo "please enter the new filename" read b #user input : dumb mv $a $b What i would like to do is for the user to enter just the "filename" for the new filename... (2 Replies)
Discussion started by: c00kie88
2 Replies

3. Shell Programming and Scripting

How do I get the name of latest file?

1) How do I get the name of latest file in a variable? 2) Is it safe to delete all files from a dir I am doing cd $dir_name if return_code > 0 rm * fi what are other alternates to delete all files from a dir in a shell script? :) (5 Replies)
Discussion started by: Hangman2
5 Replies

4. Shell Programming and Scripting

how to get the latest file

I am trying to scp the latest file which ends with "_abc.log". Can some help me figure out how can do that? (3 Replies)
Discussion started by: shehzad_m
3 Replies

5. Shell Programming and Scripting

get latest file

i have the following in my directory x: 3 files with the word "LIST" inside the files 2 files without the word "LIST" 1 folder (sudirectory) i want to get the filename of the latest file (timestamp) with the word "LIST". by the way the script and the list of files are in seperate... (4 Replies)
Discussion started by: inquirer
4 Replies

6. Shell Programming and Scripting

To get the latest file

Hi Experts Team, I wish to store the latest file name of partcular pattern in the remote server in a variable. i tried this LATEST_FILE=`ssh ${USER_ID}@${REMOTE_HOSTNAME} 'ls -t ${SOURCE_DIRECTORY}/${SOURCE_FILEPATTERN}'` but its nt working..pls guide me.. Regards, Kanda (2 Replies)
Discussion started by: spkandy
2 Replies

7. Shell Programming and Scripting

Shell script to get the latest file from the file list and move

Hi, Anybody help me to write a Shell Script Get the latest file from the file list based on created and then move to the target directory. Tried with the following script: got error. A=$(ls -1dt $(find "cveit/local_ftp/reflash-parts" -type f -daystart -mtime -$dateoffset) | head... (2 Replies)
Discussion started by: saravan_an
2 Replies

8. Shell Programming and Scripting

Retaining file versions based on input parameter

Hello Forum. I have the following files in one directory: abc_july01_2013.txt abc_july02_2013.txt abc_july03_2013.txt abc_july04_2013.txt abc_july05_2013.txt abc_july06_2013.txt abc_july07_2013.txt abc_july08_2013.txt If I want to be able to keep the last 5 versions of the file and... (4 Replies)
Discussion started by: pchang
4 Replies

9. Shell Programming and Scripting

sed Command on Multiple Files and retaining the same file name

Hi All I am trying to run sed command to remove first 2 charcaters from a file on Multiple Files in my directory and what to retain the same file name . I want to know how to retain the same file name but with changes . Can some one please let me know how to proceed with this . ... (7 Replies)
Discussion started by: honey26
7 Replies

10. Shell Programming and Scripting

Picking the latest file based on a timestamp for a Dynamic file name

Hi , I did the initial search but could not find what I was expecting for. 15606Always_9999999997_20160418.xml 15606Always_9999999998_20160418.xml 15606Always_9999999999_20160418.xml 9819Always_99999999900_20160418.xml 9819Always_99999999911_20160418.xmlAbove is the list of files I... (4 Replies)
Discussion started by: chillblue
4 Replies
MBK_WORK_LIB(1) 					     MBK ENVIRONMENT VARIABLES						   MBK_WORK_LIB(1)

NAME
MBK_WORK_LIB - define the mbk working directory SYNOPSYS
c-shell running setenv MBK_WORK_LIB unix path ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in Paris, France. Web : http://asim.lip6.fr/recherche/alliance/ E-mail : alliance-users@asim.lip6.fr DESCRIPTION
MBK_WORK_LIB sets the directory where are saved the results of an invocation of mbk or genlib. This directory is considered to be, from an mbk point of view, read and write. Also, when a file is searched for reading, the first directory to be looked at is the MBK_WORK_LIB, and then the one defined in MBK_CATA_LIB(1). The unix path argument must be a actually accessible path on your host machine. ERRORS
"mbk_fopen : can't open file 'unix_path/file.xx'" This occurs when either the unix path is irrelevent, or when the file doesn't exist if it is open for reading, or when you don't have the right on the file or directory while trying to write it. EXAMPLE
setenv MBK_WORK_LIB ~fred/crechan/uom SEE ALSO
mbk(3), genlib(1), MBK_CATA_LIB(1). BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory. We need your feedback to improve documentation and tools. ASIM
/LIP6 October 1, 1997 MBK_WORK_LIB(1)
All times are GMT -4. The time now is 05:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy