Sponsored Content
Top Forums UNIX for Beginners Questions & Answers "Revision up" instead of version up Post 303041268 by scribling on Tuesday 19th of November 2019 05:39:04 PM
Old 11-19-2019
"Revision up" instead of version up

I need to alter this script to work with a revision instead of a version.
RF_102_209_200_v001_r01.nk is the new format and I'll be revisioning up the r01 portion and not the v001.

Code:
 #!/bin/sh  

for file in "$@" 
do         
ext=${file##*.}         
base=${file%.*}         
num=${base##*v}         
zeroes=${num%%[!0]*}         
num=${num#$zeroes}  
num=$((num+1))         
base=${base%v*}         
new=$(printf '%sv%04d.%s' "$base" "$num" "$ext")         
cp -nv "$file" "$new"
 done

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Solaris

Who has "Solaris 10 Advanced System Administration(SA-202-S10)" latest revision doc?

Dear All, I am going to examine SA202 but I got SA-202-S10 revision A.1 so it might be out of date. Who has "Solaris 10 Advanced System Administration(SA-202-S10)" latest revision document? Could you share it ? Thank you in advance (2 Replies)
Discussion started by: unitipon
2 Replies

3. AIX

"pconsole" and "esaadmin" on AIX version 6

Anyone know what is the function of user "pconsole" and "esaadmin" on AIX version 6? (1 Reply)
Discussion started by: ebab3
1 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Solaris

The slices "usr", "opt", "tmp" disappeared!!! Help please.

The system don't boot. on the screen appears following: press enter to maintenance (or type CTRL-D to continue)...I checked with format command. ... the slices "0-root","1-swap","2-backup" exist. ...the slises "3-var","6-usr" -unassigned. :( (16 Replies)
Discussion started by: wolfgang
16 Replies

6. UNIX for Dummies Questions & Answers

What is the significance of sh -s in ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh?

Please can you help me understand the significance of providing arguments under sh -s in > ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh (4 Replies)
Discussion started by: Sree10
4 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
Perl::Critic::Policy::Modules::RequireVersionVar(3)	User Contributed Perl Documentation    Perl::Critic::Policy::Modules::RequireVersionVar(3)

NAME
Perl::Critic::Policy::Modules::RequireVersionVar - Give every module a "$VERSION" number. AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Every Perl file (modules, libraries, and programs) should have a package-scoped $VERSION variable. The $VERSION allows clients to insist on a particular revision of your file like this: use SomeModule 2.4; #Only loads version 2.4 This Policy scans your file for any package variable named $VERSION. I'm assuming that you are using "strict", so you'll have to declare it like one of these: our $VERSION = 1.0611; $MyPackage::VERSION = 1.061; use vars qw($VERSION); use version; our $VERSION = qv(1.0611); Perl's version system does not recognize lexical variables such as my $VERSION = 1.0611; so they are not accepted by this policy. A common practice is to use the "$Revision: 4126 $" keyword to automatically define the $VERSION variable like this: our ($VERSION) = '$Revision: 4126 $' =~ m{ $Revision: s+ (S+) }x; CONFIGURATION
This Policy is not configurable except for the standard options. NOTES
Conway recommends using the "version" pragma instead of raw numbers or 'v-strings.' However, this Policy only insists that the $VERSION be defined somehow. I may try to extend this in the future. TO DO
Add check that $VERSION is independently evaluatable. In particular, prohibit this: our $VERSION = $Other::Module::VERSION; This doesn't work because PAUSE and other tools literally copy your version declaration out of your module and evaluates it in isolation, at which point there's nothing in "Other::Module", and so the $VERSION is undefined. AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com> COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.16.3 2014-06-09 Perl::Critic::Policy::Modules::RequireVersionVar(3)
All times are GMT -4. The time now is 09:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy