Sponsored Content
Top Forums Shell Programming and Scripting Need to represent a number in 99999999 format(8 digits) Post 302683579 by kshji on Wednesday 8th of August 2012 08:31:50 AM
Old 08-08-2012
Code:
#!/usr/bin/ksh
# test:
# touch file_00000001.cvs file_00000002.cvs

# last file*.cvs file
last=$( ls -1 file*.cvs 2>/dev/null  | tail -1 )

# remove all a-z . and _ from filename
last=${last//[a-z_.]}

# if empty = no files => 1st file
[ "$last" = "" ] && last=0 # 1st file

((new=last+1))
newname=$(printf "file_%0.8d.cvs" $new)
do_something > $newname

Or make cnt file and use it
Code:
[ ! -f last.txt ] && echo "0" > last.txt # 1st id
read last < last.txt

((new=last+1))
newname=$(printf "file_%0.8d.cvs" $new)
# save id
echo "$new" > last.txt
# 
do_something > $newname

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

restrain the number of digits of a PID

How is it possible under UNIX to restrain the number of digits of the PID number? For instance, we have a product that generates a PID of 7 digits, and we would like to have only 6 digits maximum instead for the PID. Thank you for your help. (1 Reply)
Discussion started by: mlefebvr
1 Replies

2. Shell Programming and Scripting

Count number of digits in a word

Hi all Can anybody suggest me, how to get the count of digits in a word I tried WORD=abcd1234 echo $WORD | grep -oE ] | wc -l 4 It works in bash command line, but not in scripts :mad: (12 Replies)
Discussion started by: ./hari.sh
12 Replies

3. Shell Programming and Scripting

number of digits after decimal

Hi All, I have a file of decimal numbers, cat file1.txt 1.1382666907 1.2603107334 1.6118799297 24.4995857056 494.7632588468 560.7633734425 ..... I want to see the output as only 7 digits after decimal (5 Replies)
Discussion started by: senayasma
5 Replies

4. Shell Programming and Scripting

summing the digits of a binary nuMBER

please help me write a perl program to find the difference of 1 and zeros of a 6 digit binary number. eg If input is 111100 expected output +2 if input is 000011 expected output -2 input is 000111 expected output 0 (2 Replies)
Discussion started by: dll_fpga
2 Replies

5. Shell Programming and Scripting

extracting Number variable and the following digits.

HI all, I have output of something like this: crab: ExitCodes Summary >>>>>>>>> 12 Jobs with Wrapper Exit Code : 50117 List of jobs: 1-12 See https:///twiki/something/ for Exit Code meaning crab: ExitCodes Summary >>>>>>>>> 5 Jobs with Wrapper Exit Code : 8001 List of... (20 Replies)
Discussion started by: emily
20 Replies

6. Shell Programming and Scripting

Represent the data in table format as in mail content

hi all, I want to Represent the data in table format in mail content sample data should be like this...but i m trying to send this table to mail using unix command...hw do i do????even i echoed the table contents ...doesnt work.... help me <table style="background-color:lightblue;">... (8 Replies)
Discussion started by: navsan
8 Replies

7. Shell Programming and Scripting

awk changes to cut number of digits

HCPM1ONDB00014800011800000589009211201 L201307022013070228AUD 00000000031. 000965105800000000000000000000000 MOBITV KEYA ... (4 Replies)
Discussion started by: mirwasim
4 Replies

8. Shell Programming and Scripting

Find number of digits in a word

HI, Can you tell me how to find the number of digits in a word. $cat data.txt +123456ad 87645768 Output should be 6 8 (5 Replies)
Discussion started by: ashwin3086
5 Replies

9. UNIX for Dummies Questions & Answers

What does the 2nd number after the process id represent ? [ss command]

For instance, when I run ss -lptn | grep sshd , the output is as follows: LISTEN 0 128 *:22 *:* users:(("sshd",1252,3)) 1252 refers to the process id, but what does the 3 refer to ? (2 Replies)
Discussion started by: Hijanoqu
2 Replies

10. Programming

DB2 convert digits to binary format

Dear Team We use DB2 v10.5 and using DBArtisan tool Can someone please guide how to convert digits to binary numbers using db2 feature. Ex> for number 9 , binary should be 1001 ( 8+1) Any help appreciated. Thanks (2 Replies)
Discussion started by: Perlbaby
2 Replies
CVS-DEBC(1)						      General Commands Manual						       CVS-DEBC(1)

NAME
cvs-debrelease - upload a cvs-buildpackage/cvs-debuild generated package SYNOPSIS
cvs-debrelease [cvs-debrelease options] [--dopts [dupload/dput options]] DESCRIPTION
cvs-debrelease is run from the CVS working directory after cvs-buildpackage or cvs-debuild. It uses the cvs-buildpackage system to locate the .changes file generated in that run. It then uploads the package using debrelease(1), which in turn calls either dupload or dput. Note that the --dopts option must be specified to distinguish the cvs-debrelease options from the dupload or dput options. Also, the devscripts configuration files will be read, as described in the debrelease(1) manpage. Note that unlike cvs-buildpackage, the only way to specify the source package name is with the -P option; you cannot simply have it as the last command-line parameter. OPTIONS
All current cvs-buildpackage options are silently accepted; however, only the ones listed below have any effect. For more details on all of them, see the cvs-buildpackage(1) manpage. All debrelease options (as listed below) are also accepted. --dupload, --dput This specifies which uploader program to use; the default is dupload. -adebian-architecture, -tGNU-system-type See dpkg-architecture(1) for a description of these options. They affect the search for the .changes file. They are provided to mimic the behaviour of dpkg-buildpackage when determining the name of the .changes file. -Mmodule The name of the CVS module. -Ppackage The name of the package. -Vversion The version number of the package. -Ttag The CVS tag to use for exporting sources. -Rroot directory Root of the original sources archive. -Wwork directory The full path name for the cvs-buildpackage working directory. -xprefix This option provides the CVS default module prefix. --no-conf, --noconf Do not read any configuration files. This can only be used as the first option given on the command-line. --help, --version Show help message and version information respectively. SEE ALSO
cvs-buildpackage(1), debrelease(1) and cvs-debuild(1). AUTHOR
cvs-buildpackage was written by Manoj Srivastava, and the current version of debrelease was written by Julian Gilbey <jdg@debian.org>. They have been combined into this program by Julian Gilbey. DEBIAN
Debian Utilities CVS-DEBC(1)
All times are GMT -4. The time now is 09:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy