Sponsored Content
Top Forums Shell Programming and Scripting Incrementing parts of ten digits number by parts Post 302862331 by wisecracker on Thursday 10th of October 2013 02:47:19 PM
Old 10-10-2013
Here is a simple starter solution...
Code:
#!/bin/bash --posix
# num.sh
data="2013102100"
data1="${data:0:4}"
data2="${data:4:2}"
data3="${data:6:2}"
data4="${data:8:2}"
echo "$data1 $data2 $data3 $data4"
for n in {1..99}
do
	data4="0$n"
	echo "$data1 $data2 $data3 $data4"
done
data4="100"
echo "$data1 $data2 $data3 $data4"

Results...
Code:
2013 10 21 00
2013 10 21 01
2013 10 21 02
2013 10 21 03
2013 10 21 04
2013 10 21 05
2013 10 21 06
2013 10 21 07
2013 10 21 08
2013 10 21 09
2013 10 21 010
2013 10 21 011
2013 10 21 012
2013 10 21 013
2013 10 21 014
2013 10 21 015
2013 10 21 016
2013 10 21 017
2013 10 21 018
2013 10 21 019
2013 10 21 020
2013 10 21 021
2013 10 21 022
2013 10 21 023
2013 10 21 024
2013 10 21 025
2013 10 21 026
2013 10 21 027
2013 10 21 028
2013 10 21 029
2013 10 21 030
2013 10 21 031
2013 10 21 032
2013 10 21 033
2013 10 21 034
2013 10 21 035
2013 10 21 036
2013 10 21 037
2013 10 21 038
2013 10 21 039
2013 10 21 040
2013 10 21 041
2013 10 21 042
2013 10 21 043
2013 10 21 044
2013 10 21 045
2013 10 21 046
2013 10 21 047
2013 10 21 048
2013 10 21 049
2013 10 21 050
2013 10 21 051
2013 10 21 052
2013 10 21 053
2013 10 21 054
2013 10 21 055
2013 10 21 056
2013 10 21 057
2013 10 21 058
2013 10 21 059
2013 10 21 060
2013 10 21 061
2013 10 21 062
2013 10 21 063
2013 10 21 064
2013 10 21 065
2013 10 21 066
2013 10 21 067
2013 10 21 068
2013 10 21 069
2013 10 21 070
2013 10 21 071
2013 10 21 072
2013 10 21 073
2013 10 21 074
2013 10 21 075
2013 10 21 076
2013 10 21 077
2013 10 21 078
2013 10 21 079
2013 10 21 080
2013 10 21 081
2013 10 21 082
2013 10 21 083
2013 10 21 084
2013 10 21 085
2013 10 21 086
2013 10 21 087
2013 10 21 088
2013 10 21 089
2013 10 21 090
2013 10 21 091
2013 10 21 092
2013 10 21 093
2013 10 21 094
2013 10 21 095
2013 10 21 096
2013 10 21 097
2013 10 21 098
2013 10 21 099
2013 10 21 100

This User Gave Thanks to wisecracker For This Post:
 

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
DAYLIGHT(3P)						     POSIX Programmer's Manual						      DAYLIGHT(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
daylight -- daylight savings time flag SYNOPSIS
#include <time.h> extern int daylight; DESCRIPTION
Refer to tzset(). COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Stan- dard is the referee document. The original Standard can be obtained online at http://www.unix.org/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE
/The Open Group 2013 DAYLIGHT(3P)
All times are GMT -4. The time now is 01:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy