"Remove the date portion from file name"

Post #302598499 by bartus11 on Tuesday 14th of February 2012 05:03:29 PM

perl -pe 's/_\d+//' file

Test Your Knowledge in Computers #696
Difficulty: Medium
The Cathedral model, in which source code is available with each software release, but code developed between releases, is restricted to an exclusive group of software developers.
True or False?

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

Please help, need to create script to remove lines by date in file

Please Help (novice to PERL and SHELL scripting)…. Need to create a script which removes all lines in $filename = "cycle_calendar_ftp_out" older than current date – a variable which will be a number of days passed to script. For Ex it will look at the end date which is the last field (4) and... (2 Replies)
Discussion started by: m3pwr
2 Replies
BACKUP_SETEXP(8)					       AFS Command Reference						  BACKUP_SETEXP(8)

       backup_setexp - Sets the expiration date for existing dump levels.

       backup setexp -dump <dump level name>+
	   [-expires <expiration date>+] [-localauth]
	   [-cell <cell name>] [-help]

       backup se -d <dump level name>+
	   [-e <expiration date>+]
	   [-l] [-c <cell name>] [-h]

       The backup setexp command sets or changes the expiration date associated with each specified dump level, which must already exist in the
       dump hierarchy.

       Use the -expires argument to associate an expiration date with each dump level. When the Backup System subsequently creates a dump at the
       dump level, it uses the specified value to derive the dump's expiration date, which it records on the label of the tape (or backup data
       file). The Backup System refuses to overwrite a tape until after the latest expiration date of any dump that the tape contains, unless the
       backup labeltape command is used to relabel the tape. If a dump level does not have an expiration date, the Backup System treats dumps
       created at the level as expired as soon as it creates them.

       (Note that the Backup System does not automatically remove a dump's record from the Backup Database when the dump reaches its expiration
       date, but only if the tape that contains the dump is recycled or relabeled. To remove expired and other obsolete dump records, use the
       backup deletedump command.)

       Define either an absolute or relative expiration date:

       o   An absolute expiration date defines the month/day/year (and, optionally, hour and minutes) at which a dump expires. If the expiration
	   date predates the dump creation time, the Backup System immediately treats the dump as expired.

       o   A relative date defines the number of years, months, or days (or a combination of the three) after the dump's creation that it expires.
	   When the Backup System creates a dump at the dump level, it calculates an actual expiration date by adding the relative date to the
	   start time of the dump operation.

       If the command is used to change an existing expiration date associated with a dump level, the new date applies only to dumps created after
       the change. Existing dumps retain the expiration date assigned at the time they were created.

       -dump <dump level name>+
	   Specifies the full pathname of each dump level to assign the expiration date specified by the -expires argument.

       -expires <expiration date>+
	   Defines the absolute or relative expiration date to associate with each dump level named by the -dump argument. Absolute expiration
	   dates have the following format:

	      [at] {NEVER | <mm>/<dd>/<yyyy> [<hh>:<MM>] }

	   where the optional word at is followed either by the string "NEVER", which indicates that dumps created at the dump level never expire,
	   or by a date value with a required portion (<mm> for month, <dd> for day, and <yyyy> for year) and an optional portion (<hh> for hours
	   and <MM> for minutes).

	   Omit the <hh>:<MM> portion to use the default of midnight (00:00 hours), or provide a value in 24-hour format (for example, "20:30" is
	   8:30 p.m.).	Valid values for the year range from 1970 to 2037; higher values are not valid because the latest possible date in the
	   standard UNIX representation is in February 2038. The command interpreter automatically reduces later dates to the maximum value.

	   Relative expiration dates have the following format:

	      [in] [<years>y] [<months>m] [<days>d]

	   where the optional word in is followed by at least one of a number of years (maximum 9999) followed by the letter "y", a number of
	   months (maximum 12) followed by the letter "m", or a number of days (maximum 31) followed by the letter "d". If providing more than one
	   of the three, list them in the indicated order. If the date that results from adding the relative expiration value to a dump's creation
	   time is later than the latest possible date in the UNIX time representation, the Backup System automatically reduces it to that date.

	   Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The backup command interpreter presents it to
	   the Backup Server, Volume Server and VL Server during mutual authentication. Do not combine this flag with the -cell argument. For more
	   details, see backup(8).

       -cell <cell name>
	   Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see backup(8).

	   Prints the online help for this command. All other valid options are ignored.

       The following example associates an absolute expiration date of 10:00 p.m. on 31 December 1999 with the dump level "/1998/december":

	  % backup setexp -dump /1998/december -expires at 12/31/1999 22:00

       The following example associates a relative expiration date of 7 days with the two dump levels "/monthly/week1" and "/monthly/week2":

	  % backup setexp -dump /monthly/week1 /monthly/week -expires 7d

       The issuer must be listed in the /etc/openafs/server/UserList file on every machine where the Backup Server is running, or must be logged
       onto a server machine as the local superuser "root" if the -localauth flag is included.

       backup(8), backup_adddump(8), backup_deldump(8), backup_listdumps(8)

       IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.

       This documentation is covered by the IBM Public License Version 1.0.  It was converted from HTML to POD by software written by Chas
       Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.

OpenAFS 							    2012-03-26							  BACKUP_SETEXP(8)

Featured Tech Videos

All times are GMT -4. The time now is 03:08 AM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy