Sponsored Content
Full Discussion: Date comparison script
Top Forums Shell Programming and Scripting Date comparison script Post 302736367 by baris35 on Tuesday 27th of November 2012 06:17:53 AM
Old 11-27-2012
Date comparison script

hi,

I have a file named user.cfg under /var/member/

Code:
 
#user.cfg file under /var/member/
login user: root #how are you
login pass: admin #where are you
M: user1 pass1 #20121008
M: user2 pass2 #20111230
M: user3 pass3 #20091220
M: user4 pass4 #20070210
M: user5 pass5 #20130708
M: user6 pass6 #20141008
M: user7 pass7 #20101008
.
.
.
.
M: user90 pass90 #20121222
M: user91 pass91 #20121227
M: user92 pass92 #20131102
M: user93 pass93 #20120809

What I would like to do is to have a script to read user.cfg file, it will search each line only starting with "M:" and find # sign in each line, then will check expired dates.
If the date is expired, the script shall remove related lines and will save by overwriting the existing user.cfg file.

So the output of user.cfg should be :

Code:
 
#user.cfg file under /var/member/
login user: root #how are you
login pass: admin #where are you
M: user5 pass1 #20130708
M: user6 pass1 #20141008
.
.
.
.
M: user90 pass90 #20121222
M: user91 pass91 #20121227
M: user92 pass92 #20131102

I have read some other threads about date comparison but none of them exactly the same with my user.cfg file.

Thanks in advance
Baris35
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

date comparison

How can I compare two dates in String format (eg. May 23 2006 05:30:21) in AWK? Thanks (2 Replies)
Discussion started by: dkr123
2 Replies

2. Shell Programming and Scripting

Date comparison

Hi all, I've a shell script which runs on Bourne shell. I've to do a date comparison. If the value of the supplied parameter(in format YYYYMMDD)is greater than todays's date(format YYYYMMDD), it should prompt the user that the supplied date is greater than today's date. The script is given... (6 Replies)
Discussion started by: sumesh.abraham
6 Replies

3. Shell Programming and Scripting

date comparison in bash

Hi I have this simple script: #!/bin/bash date1=2009:07:15:12:36 date2=2009:07:15:12:16 echo $date1 echo $date2 datediff= #datediff=date1-date2 echo datediff is$datediff How do i return the difference in seconds? (6 Replies)
Discussion started by: carp.dk
6 Replies

4. Homework & Coursework Questions

Date comparison with 'string date having slashes and time zone' in Bash only

1. The problem statement, all variables and given/known data: I have standard web server log file. It contains different columns (like IP address, request result code, request type etc) including a date column with the format . I have developed a log analysis command line utility that displays... (1 Reply)
Discussion started by: TariqYousaf
1 Replies

5. Solaris

Date comparison

Date comparison Hello all I am writing a scrip that will take action so long as the date with in the file is older than 3 months. The file will contain multiple rows of data. Each row will probably start with the date. My question... What is the exact code that should be used for date... (1 Reply)
Discussion started by: UofU
1 Replies

6. UNIX for Dummies Questions & Answers

date comparison

Hi friends, I would like to compare two dates in an IF statement. This is what I am trying, but it doesn't work. date=20120122 minus=6 if ; then ... fi what would the IF clause looks like? Thanks! :) (5 Replies)
Discussion started by: kokoro
5 Replies

7. Shell Programming and Scripting

Date and Time comparison using shell script

Hi, I'm having two fields in the file F1|F2 20111220|102000 F1 ->YYYYMMDD F2 ->HHMMSS Now, I need to compare this with current date & time and need to return the difference value in hours. Already, I checked with datecalc from the forum. So, need hints from Shell Gurus. Thanks (10 Replies)
Discussion started by: buzzusa
10 Replies

8. Shell Programming and Scripting

Date Comparison

Hi Need some function or step to compare the date as given below. Example: Date_1: 25/04/2013 Date_2: 20/07/2012 if Date_1 is greater than Date_2 then do... else do.. fi Need exact unix steps to compare the above condition Use code tags please, see PM. (5 Replies)
Discussion started by: anshaa
5 Replies

9. UNIX for Dummies Questions & Answers

Date comparison

I have below txt file 02.05.2014 10.05.2014 17.09.2014 My requirement is the user enter date field should compare the input file if user enter date as 12.03.2013 it should compare with all date one by one from input file 12.03.2013 -ne 02.05.2014 12.03.2013 -ne 10.05.2014... (3 Replies)
Discussion started by: stew
3 Replies

10. Shell Programming and Scripting

awk IF date comparison help

Hey everyone, I'm trying to create a script using awk and if that will list all of our aws tapes that have archived date that is past 90 days from todays current date, so that I can pass that to my aws command to remove. The fifth column is the creation date in epoch/seconds, so I'm... (13 Replies)
Discussion started by: beyondmondays
13 Replies
UPDATE-UPDMAP(8)					      System Manager's Manual						  UPDATE-UPDMAP(8)

NAME
update-updmap -- generate updmap.cfg from files in /etc/texmf/updmap.d/ SYNOPSIS
update-updmap [option ...] DESCRIPTION
This manual page documents update-updmap, a program that was written for the Debian distribution. Overview update-updmap is used to generate updmap(1)'s and updmap-sys(8)'s site-wide configuration file, /var/lib/texmf/web2c/updmap.cfg, or the per- user configuration file, TEXMFCONFIG/web2c/updmap.cfg, from the files with names ending in '.cfg' located in /etc/texmf/updmap.d/. The base TeX packages (texlive-) provide files in /etc/texmf/updmap.d/, which define the base contents of the to-be-generated /var/lib/texmf/web2c/updmap.cfg (general settings and base fonts), or the per-user file TEXMFCONFIG/web2c/updmap.cfg. With the underlying mechanism, system administrators can disable the map files they want by commenting their entries in the appropriate files under /etc/texmf/updmap.d/. Such changes will be preserved if the package in question is removed (not purged) and then reinstalled. Users without local administration rights can use update-updmap to merge their local configuration and an updated site-wide configuration (see User-specific configuration below). The local configuration files, unless specified otherwise, are expected in $TEXMFCONFIG/updmap.d, (that is ~/.texmf-config/updmap.d ), and the default output file is $TEXMFVAR/web2c/updmap.cfg (in other words, ~/.texmf-var/web2c/updmap.cfg ). Thanks to update-updmap, TeX-related font packages can have their own font map files referenced in /var/lib/texmf/web2c/updmap.cfg without having to edit that file. The packages simply have to ship their map files (e.g., foo.map) in /etc/texmf/map/dvips/ and one or more '.cfg' file(s) under /etc/texmf/updmap.d/ (e.g., 10foo.cfg) referencing the map files. Mode of operation update-updmap concatenates all the '.cfg' files under /etc/texmf/updmap.d/ provided that: - they do not contain the following pseudo-comment: # -_- DebPkgProvidedMaps -_- or; - they have this pseudo-comment, are up-to-date (i.e., the same file with suffix '.dpkg-new' doesn't exist) and are listed in a '.list' file under /var/lib/tex-common/fontmap-cfg/, meaning that the package shipping the '.cfg' file is installed. The name of the '.list' file is ignored (but should be the name of the package that installed it). The file should contain the names of the '.cfg' files in /etc/texmf/updmap.d/ that should be enabled, without the '.cfg' suffix, e.g. 10foo 12bar The first case is for configuration files added by the local system administrator. Files that contain the magic pseudo-comment should be used by Debian packages. In this case, only the base name should appear in the '.list' file: for instance, '10foo' for /etc/texmf/updmap.d/10foo.cfg; please refer to the Debian TeX Policy for details. Names for configuration files Filenames should begin with two digits and must have the extension '.cfg'. The order used to process the files is obtained by running sort(1) with the 'C' locale (for ordinary alphanumeric characters, it corresponds to the ASCII order). The result obtained by concatenating them is stored as the new updmap.cfg. Note that updmap(1)and updmap-sys(8)don't care about the order of entries, the sorting is just for the user's convenience. If you want to be able to use updmap(1)'s or updmap-sys(8)'s option --enable and --setoption, some further Restrictions apply to the file- names used and the way entries are distributed among these files. For --setoption to work, the options (like dvipsPreferOutline) must be kept in a file named 00updmap.cfg, either in /etc/texmf/updmap.d/ as installed by the tex-common package, or in the conf-dir you specified. If you use --enable Map some.map and there is no mention of some.map in any file in /etc/texmf/updmap.d/ (and in conf-dir, if specified), then the Map line will be introduced in a file whose name matches *local*.cfg if it exists, or 99local.cfg will be created (in conf-dir if specified). For this to work, you cannot have more than one file that matches that name, except that you can use conf-dir/*local.cfg to supersede the site-wide file in /etc/texmf/updmap.d/. In order to enable a Map file that already is listed in your configuration files, it must be commented with the string '#! '. This is the sort of lines that updmap --disable some.map will produce - see also updmap.cfg(5). If such a line occurs in more than one file, updmap(1) will fail. Again the exception is a file in conf-dir that shadows entries in a site-wide file. Although not strictly mandatory, it is wise to keep corresponding Map entries in files with the same name in conf-dir and the site-wide dir. Otherwise, the results may seem unpredictable. User-specific configuration If you want a different configuration for updmap(1) than the setup at your site provides, you can place changed copies of the configuration files from /etc/texmf/updmap.d/ in a directory below $TEXMFCONFIG, or create additional files there. Per default, files are looked for in $TEXMFCONFIG/updmap.d, where $TEXMFCONFIG is ~/.texmf-config unless the configuration has been changed. When you call update-updmap as a user, it will produce a user-specific updmap.cfg file as follows: if files with the same name exist in both directories, the version in ~/.texmf-config/updmap.d/ will be used; files with unique names will be used from either directory. If you want to keep your files elsewhere, specify their location with options (see OPTIONS below). OPTIONS
-c, --conf-dir conf-dir in user-specific mode, use configuration files from conf-dir instead of $TEXMFCONFIG/updmap.d/ -o, --output-file outputfile in user-specific mode, generate outputfile instead of $TEXMFVAR/web2c/updmap.cfg --check Executes additional checks that all necessary files are present in the kpathsea database. Don't use this in maintainer scripts. --quiet don't write anything to the standard output during normal operation --help print a summary of the command-line usage of update-updmap and exit --version output version information and exit Note that the -v option, which turns on verbose mode, is deprecated. We are currently in a transition phase where quiet mode is still the default (therefore, --quiet has no effect), but update-updmap will be verbose by default as soon as enough packages use --quiet in their maintainer scripts. SYNTAX FOR THE .CFG FILES The '.cfg' files under /etc/texmf/updmap.d/ should contain valid configuration lines for updmap(1). Usually, they will consist of lines of following one of these forms: Map <foo.map> MixedMap <bar.map> The MixedMap form should only be used if the font is available in both bitmap and scalable formats (this way, it won't be declared in the default map file for Dvips that is used when dvipsPreferOutline is set to 'false' in updmap.cfg). The following comment (from updmap(1)'s point of view): # -_- DebPkgProvidedMaps -_- is treated in a particular way by update-updmap (see section Mode of operation above) and should be used in every '.cfg' file provided by a Debian package. This ensures that the corresponding map files are disabled when the package is removed and reenabled when the package is reinstalled. FILES
/etc/texmf/updmap.d/00updmap.cfg /etc/texmf/updmap.d/*.cfg /var/lib/texmf/web2c/updmap.cfg /var/lib/tex-common/fontmap-cfg/*.list DIAGNOSTICS
update-updmap returns 0 on success, or a strictly positive integer on error. SEE ALSO
updmap(1) /usr/share/doc/tex-common/README.Debian.{txt,pdf,html} /usr/share/doc/tex-common/Debian-TeX-Policy.{txt,pdf,html} /usr/share/doc/tex-common/TeX-on-Debian.{txt,pdf,html} AUTHORS
This manual page was written by Atsuhito Kohda <kohda@debian.org> and updated by Florent Rougon <f.rougon@free.fr> and Frank Kuester <frank@debian.org> for the Debian distribution (and may be used by others). Debian Jul 19, 2005 Debian
All times are GMT -4. The time now is 11:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy