Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Remove the date portion from file name Post 302598495 by Vijay81 on Tuesday 14th of February 2012 04:55:13 PM
Old 02-14-2012
Remove the date portion from file name

hi,
I am trying to remove the last field before the period (.) from a list of file names in a directory in a shell script.
Below is the list of file names.

PHP Code:
ENVID_archival_20120214092258.log            
ENVID_Get_Source_Files_20120214091828
.log  
ENVID_Get_Source_Files_20120214092523
.log
ENVID_email_notification_20120214091829
.log  
ENVID_Get_Source_Files_20120214092026
.log 
_ and the date part followed by it have to be removed and the result should be:
PHP Code:
ENVID_archival.log            
ENVID_Get_Source_Files
.log  
ENVID_Get_Source_Files
.log
ENVID_email_notification
.log  
ENVID_Get_Source_Files
.log 
I tried with cut. But as the date field position is dynamic, I could not get it through successfully. can some one help?

thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove portion of file

Can anyone tell me how to remove a portion of a large file to smaller ones? What I have is a large file that was created becasue several similar files were joined together. Each individual file starts with MSG_HEAD. I want to take everything from MSG_HEAD up to were it says MSG_HEAD again and... (13 Replies)
Discussion started by: methos
13 Replies

2. HP-UX

How do I take out(remove) the date part in the file name?

Hi Guys here I am again, I have two files in a specified location. Location ex: /opt/xdm/input/ input file names: 1. abc_app.yyyymmdd.dtd 2. abd_app.yyyymmdd.dtd I need to build a code that reads the files from the location based on the oldest date and cuts the date part... (5 Replies)
Discussion started by: ruthless
5 Replies

3. Shell Programming and Scripting

extract date portion from file

Hi, I have a file where there is a date field (single line variable length file) how to extract just the date portion from it the position of date field may vary anywhere in the line but will always have the format mm-dd-yyyy for eg . xxxxxxxxxxxxxxx09-10-2006xxxxxxxxxxxxxxxxxxxx (5 Replies)
Discussion started by: misenkiser
5 Replies

4. UNIX for Dummies Questions & Answers

Remove the date from the file

Hi I am getting the file which is having the format as follows: set-I abcxyz20080109 abc20080110 Set-II abc-20070109 abcxyz-20070110 I need to get only the file name without date as Set-I abcxyz abc Set-II abc (5 Replies)
Discussion started by: pradkumar
5 Replies

5. Shell Programming and Scripting

How to remove '-' for date fields alone in a file

Hi, I have a scenario like, I need to replace a hyphens(-) for date field alone in the file. I have minus(-) sign for other fields it should remain as such, only for date fields hyphens must be removed. Please find the content for the file below: sample.txt: -----------... (4 Replies)
Discussion started by: G.K.K
4 Replies

6. Shell Programming and Scripting

Remove first portion of string

I have a script which currently uses a file containing a list of directories as an argument. The file is read in to an array, and then the array is iterated in a for loop. What I would like to do is cut off the first few directories of the directory path (they won't exist on the server where the... (5 Replies)
Discussion started by: msarro
5 Replies

7. Shell Programming and Scripting

remove large portion of web page code between two tags

Hi everybody, I am trying to remove bunch of lines from web pages between two tags: one is <h1> and the other is <table it looks like <h1>Anniversary cards roses</h1> many lines here <table summary="Free anniversary greeting cards." cellspacing="8" cellpadding="8" width="70%">my goal... (5 Replies)
Discussion started by: georgi58
5 Replies

8. Shell Programming and Scripting

How to remove the date part of the file?

Hi Gurus, I have file name like: abcd.20131005.dat I need to remove mid part of data final name should be abcd.dat thanks in advance (2 Replies)
Discussion started by: ken6503
2 Replies

9. Shell Programming and Scripting

How do I take out(remove) the date part in the file name in a script?

Hi All, I need to create links between two directories. have multiple files in a specified location. Source Location ex: /opt/xdm/input/ Target Location ex: /opt/xdm input file names: 1. abc_app.aus.apac.yyyymmdd.dtd 2. abcd_app.aus.apac.yyyymmdd.dtd I need to build a code that reads... (1 Reply)
Discussion started by: kthri_82
1 Replies

10. Shell Programming and Scripting

Remove the leading and trailing date from a CSV file

I'm a newbie to shell scripting. Can anyone help with the below requirement ? The leading and trailing date of a files to be removed. 2017-07-12_gmr_tag_log_20170711.csv 2017-07-12_gmr_call_log_20170711.csv 2017-07-12_gmr_outgoing_log_20170711.csv I'm looking for output like... (7 Replies)
Discussion started by: shivamayam
7 Replies
HTTP_CACHE_LAST_MODIFIED(3)						 1					       HTTP_CACHE_LAST_MODIFIED(3)

http_cache_last_modified - Caching by last modification

SYNOPSIS
bool http_cache_last_modified ([int $timestamp_or_expires]) DESCRIPTION
Attempts to cache the sent entity by its last modification date. If the supplied argument is greater than 0, it is handled as timestamp and will be sent as date of last modification. If it is 0 or omit- ted, the current time will be sent as Last-Modified date. If it's negative, it is handled as expiration time in seconds, which means that if the requested last modification date is not between the calculated timespan, the Last-Modified header is updated and the actual body will be sent. A log entry will be written to the cache log if the INI settinghttp.log.cache is set and the cache attempt was successful. Note This function may be used in conjunction with http_send_data(3), http_send_file(3) and http_send_stream(3). PARAMETERS
o $timestamp_or_expires - Unix timestamp RETURN VALUES
Returns FALSE or exits on success with 304 Not Modified if the entity is cached. See the INI settinghttp.force_exit for what "exits" means. EXAMPLES
Example #1 A http_cache_last_modified(3) example Caching for 5 seconds. <?php http_cache_last_modified(-5); printf("%s ", http_date()); ?> SEE ALSO
http_cache_etag(3), the HttpResponse class if you are using PHP 5.1.0 and above. PHP Documentation Group HTTP_CACHE_LAST_MODIFIED(3)
All times are GMT -4. The time now is 05:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy