Sponsored Content
Top Forums Shell Programming and Scripting Incrementing parts of ten digits number by parts Post 302862465 by wisecracker on Thursday 10th of October 2013 08:40:45 PM
Old 10-10-2013
Code:
#!/bin/bash --posix
# Apple Macbook Pro 13", circa 10-08-2012, OSX 10.7.5, default bash terminal.
# 
# Now obtain any date and add 00 to 099 at the end.
# It is simple to add the last 100 after every day.
# You may have to change pieces to suit you environment and OS etc...
for newdate in {0..365}
do
	# Get epoch time and use IT to do all of the hard work...
	secs=$(date +"%s")
	secs=$[ ( ( ( $secs / 86400 ) * 86400 ) + ( $newdate * 86400 ) ) ]
	for n in {0..99}
	do
		# Date WITH spaces...
		# currentdate=$(date -r $secs +"%Y %m %d")
		# Date WITHOUT spaces...
		currentdate=$(date -r $secs +"%Y%m%d")
		data="0$n"
		# Result WITH spaces...
		# currentdate="$currentdate $data"
		# Result WITHOUT spaces...
		currentdate="$currentdate$data"
		echo "$currentdate"
	done
done
# Now all you have to do is add your I/O and any comparing parts...

This will print a whole years worth of dates with extensions of 00 to 099 to STDOUT.
Code:
AMIGA:barrywalker~> ./Up_Date.sh
2013101100
2013101101
2013101102
2013101103
2013101104
2013101105
2013101106
2013101107
2013101108
2013101109
20131011010
20131011011
20131011012
20131011013
20131011014
20131011015
20131011016
20131011017
20131011018
20131011019
20131011020
20131011021
20131011022
.
.
.
.
.
.
20141011077
20141011078
20141011079
20141011080
20141011081
20141011082
20141011083
20141011084
20141011085
20141011086
20141011087
20141011088
20141011089
20141011090
20141011091
20141011092
20141011093
20141011094
20141011095
20141011096
20141011097
20141011098
20141011099
AMIGA:barrywalker~>


Last edited by wisecracker; 10-10-2013 at 09:51 PM.. Reason: Typo in none code line...
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cksum parts of a file

Every time we build an executable the date and time are put into the file, I need to run checksum on just the working lines.(IE, no header files) Is this even possible, if so how would I go about it? I am using a HP-UX server any help you can give me will be greatly appreciated. Thanks (6 Replies)
Discussion started by: crazykelso
6 Replies

2. Shell Programming and Scripting

getting parts of a file

Hello, I'm trying to retreive certain bits of info from a file. the file contains a list like this info1:info2:info3:info4 info1:info2:info3:info4 info1:info2:info3:info4 info1:info2:info3:info4 how do i pick out only info2 or only info3 without the others? Thanks (11 Replies)
Discussion started by: bebop1111116
11 Replies

3. Shell Programming and Scripting

Extracting parts of a file.

Hello, I have a XML file as below and i would like to extract all the lines between <JOB & </JOB> for every such occurance. The number of lines between them is not fixed. Anyways to do this awk? ============ <JOB APR="1" AUG="1" DEC="1" FEB="1" JAN="1" JUL="1" JUN="1" MAR="1" MAY="1"... (3 Replies)
Discussion started by: srivat79
3 Replies

4. Shell Programming and Scripting

[ask]break line number into several parts

hlow all, i have file with wc -l file.txt is 3412112 line number so I want to break these files into several parts with assumsi line 1-1000000 will be create part1.txt and 1000001-2000000 will create part2.txt and 2000001-3000000 will create part3.txt and 3000001-3412112 will create... (5 Replies)
Discussion started by: zvtral
5 Replies

5. Shell Programming and Scripting

Parts is parts, but all together ...

I understand the individual pieces of the following (with one exception ..), but how does it all work as one? find ${HOME}/reports/ -name surveyresult*.txt -exec ls -1 {} \; | /usr/xpg4/bin/grep -E \ "${HOME}/reports/surveyresult{14,14}.txt" | sort > ${ResultsFileList} Find all files like... (1 Reply)
Discussion started by: jdorn001
1 Replies

6. Shell Programming and Scripting

Extract Parts of File

Hello All, I have a file like this Define schema flat_file_schema ( a varchar(20) ,b varchar(30) ,c varchar(40) ); (Insert into table ( a ,b ,c ) values ( 1 ,2 ,3 ); (4 Replies)
Discussion started by: nnani
4 Replies

7. Shell Programming and Scripting

Combine two parts of a file

Hello All, I have a file like this APPLY ( 'INSERT INTO brdcst_media_cntnt ( cntnt_id ,brdcst_media_cntnt_cd ,cntnt_prvdr_cd ,data_src_type_cd ,cntnt_titl_nm ,cntnt_desc ,batch_dt ,batch_id ) VALUES ( :cntnt_id (3 Replies)
Discussion started by: nnani
3 Replies

8. Shell Programming and Scripting

Getting various parts from the log

I am dealing with some app log, see example below: 22:16:13.601 ClientSession(905)--Connection(5)--SELECT GETDATE() 22:16:13.632 ClientSession(158)--Connection(5)--SELECT 1 22:16:13.632 ClientSession(848)--Connection(6735)--SELECT 1 So far I needed to collect certain column from it, such as... (3 Replies)
Discussion started by: migurus
3 Replies

9. Shell Programming and Scripting

How to get first four parts of the string?

I have the string: XXXX.YYYY_ZZZ.20180724.01.txt I need to get rid of .txt and get full four parts XXXX.YYYY_ZZZ.20180724.01 I did: CTL=`echo XXXX.YYYY_ZZZ.20180724.01.txt | rev | cut -d"." -f4 | rev` But got only YYYY_ZZZ What should I do to get all four parts of that... (4 Replies)
Discussion started by: digioleg54
4 Replies
opendkim-genzone(8)					      System Manager's Manual					       opendkim-genzone(8)

NAME
opendkim-genzone - DKIM public key zone file generation tool SYNOPSIS
opendkim-genzone [-C address] [-d domain] [-D] [-E secs] [-N ns[,...]] [-o file] [-r secs] [-R secs] [-S] [-t secs] [-T secs] [-v] [-x conffile] [dataset] DESCRIPTION
opendkim-genzone generates a file suitable for use with named(8) to publish a set of public keys. The dataset parameter should specify a set of data as described in the opendkim(8) man page. It can currently refer to flat files, Sleepy- cat databases, comma-separated lists, LDAP directories or SQL databases. The dataset may be omitted if a configuration file (via the -x command line flag) is specified referring to a configuration file that sets a KeyTable parameter, in which case that value will be used. The database contents should be formatted as described for the KeyTable parameter, described in the opendkim.conf(5) man page. OPTIONS
-C contact Uses contact as the contact information to be used when an SOA record is generated (see -S below). If not specified, the userid of the executing user and the local hostname will be used; if the executing user can't be determined, "hostmaster" will be used. -d domain Restricts output to those records for which the domain field is the specified domain. -D Adds a "._domainkey" suffix to selector names in the zone file. -E secs When generating an SOA record (see -S below), use secs as the default record expiration time. The default is 604800. -N nslist Specifies a comma-separated list of nameservers, which will be output in NS records before the TXT records. The first nameserver in this list will also be used in the SOA record (if -S is also specified) as the authority hostname. -o file Sends output to the named file rather than standard output. -r secs When generating an SOA record (see -S below), use secs as the zone refresh time. The default is 10800. -R secs When generating an SOA record (see -S below), use secs as the zone retry time. The default is 1800. -S Asks for an SOA record to be generated at the top of the output. The content of this output can be controlled using the -E, -r, -R, -T options. The serial number will be generated based on the current time of day. -t ttl Puts a TTL (time-to-live) value of ttl on all records output. The units are in seconds. -T secs When generating an SOA record (see -S below), use secs as the default record TTL time. The default is 86400. -v Increases the verbosity of debugging output written to standard error. -x conffile Names an opendkim.conf(5) file to be read for LDAP-specific parameters when an LDAP dataset is given on the command line. Not required for other dataset types. The default is /etc/opendkim.conf. VERSION
This man page covers the version of opendkim-genzone that shipped with version 2.6.8 of OpenDKIM. COPYRIGHT
Copyright (c) 2010, 2012, The OpenDKIM Project. All rights reserved. SEE ALSO
opendkim(8), opendkim.conf(5) The OpenDKIM Project opendkim-genzone(8)
All times are GMT -4. The time now is 07:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy