Sponsored Content
Top Forums UNIX for Beginners Questions & Answers UNIX replacing and incrementing number Post 303037509 by chamajid on Saturday 3rd of August 2019 05:42:50 PM
Old 08-03-2019
Hi Don/Peasant,

Peasant, I did not have a clue on how to start, had a a mental block so could not do an attempt. I am searching for a script that does atleast some part of it but whenever i change it i get errors and just left me frustrated. Hence i made this post. I will try this and see if it works. thank you for your attempt. I will add a post once i give it a shot.

Don,

Looks like I messed up. Sorry about missing code tags. I will put extra effort to follow the rules. I would recommend if you can put some validation so it does not allow any one posting without code tags. But you will not see that from me every again hopefully. I will put in the explanation with more information.

we have one file that has our sql code that has code numbers to identify if there is an error we can find it with the code number. those code number should should start with
Code:
'0001'

and have code section and then
Code:
 '0002'

and so on, where ever there is a .
Code:
.001

, ""the current number" repeats.

It looks like this. I have changed it start from 1. so Basically I want to update what ever is the number in the
Code:
'0001'

. I have already built up the file by copying pasting code blocks but not updated the numbers 1 by 1. it is a 10000 code blocks file. and it is very laborious to change it one by one to 10000

Code:
l_code_number := (l_src||'0001')::num
(code)
l_code_number := (l_src||'0002')::num
(code)
l_code_number := (l_src||'0002'||'.001')::num
(code)
l_code_number := (l_src||'0003')::num
(code)
l_code_number := (l_src||'0004')::num
(code)
l_code_number := (l_src||'0004'||'.001')::num

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl + array and incrementing number

morning guys and gals, I am haveing a problem, a friend helped me out with this script but i dont know how to add incrementing number for each movie in movie.list. this is what i have so far. any assistance would be great. I have removed the GT and LT symbols so you can see what is going on... (5 Replies)
Discussion started by: Optimus_P
5 Replies

2. Shell Programming and Scripting

Replacing the first 0 with a number

Hi, Appreciate any help in advance ;-) There are some numbers between 0 and 1, 0 not included: .2500, .3333, .5000, .6666, .7500, 1.000 How to replace the first 0 ( after the dot ) with a number, say, if the number is 3: .2500 will be .2530 .5000 will be .5300 .7500 will be .7530 ... (3 Replies)
Discussion started by: wanttolearn
3 Replies

3. Shell Programming and Scripting

Replacing word and Incrementing

Hi I'm having difficulty in writing a script with searching a specified word using sed and replaces that word with numbers that is incremented I tried this: #!/bin/sh awk '{ for (i=2010; i<=NF; i++) sed 's/TBA/$i; }' filename.txt > outputfile.txt but it doesn't work. here is my desired... (1 Reply)
Discussion started by: sexyTrojan
1 Replies

4. Shell Programming and Scripting

Unix c-shell - replacing/incrementing values in columns?

2 21 1 12 3 123 4 1234 6 49 0 49 33 212 I need to replace/increment all the values in the 2nd column that correspond to 0 in the first column. so for 0 49 i would get 0 50 this can be done through: paste num4.txt... (14 Replies)
Discussion started by: audrey_flox
14 Replies

5. Shell Programming and Scripting

Replacing Port number Using Sed

Hi Im trying to replace http port value.However for some reason its not working.Can you guys take a look and hit me with suggestions please.Your help is much appreciated. echo "Enter Value" read ans sed -i "s/http-port = 80 /http-port = $ans/g" demo Note:demo is the filename ... (6 Replies)
Discussion started by: coolkid
6 Replies

6. Shell Programming and Scripting

Incrementing number in bash

I have the following code and getting the error ./raytrac.bash: line 231: ((: 0++: syntax error: operand expected (error token is "+") iarg = 0 iarg=0 narg=$# # Number of arguments passed. echo "narg = $narg" argsArr=("$@") # Set... (1 Reply)
Discussion started by: kristinu
1 Replies

7. UNIX for Dummies Questions & Answers

Incrementing the New File Version Number

Hello All, In the below script i am trying to check and list the file names, get the last file with highest version number and then increment the version number when i create another file. Example: file1 is COBANK_v1.xml and file2 i want to put it as COBANK_v2.xml, to achieve this i am using awk... (15 Replies)
Discussion started by: Ariean
15 Replies

8. Shell Programming and Scripting

Replacing string by incrementing number

Dear all Say I have a file as ! TICKET NBR : 234 !GSI : 102 ! 3100.2.112.1 11/06/2013 15:56:29 ! 3100.2.22.3 98 ! 3100.2.134.2 8 ! ! TICKET NBR : 1809 ! GSI : 102 ! 3100.2.112.1 11/06/2013 16:00:45 ! 3100.2.22.3 65 ! 3100.2.134.2 3 ! ! TICKET NBR : 587 ! GSI : 102 ! 3100.2.112.1... (3 Replies)
Discussion started by: OTNA
3 Replies

9. Shell Programming and Scripting

Incrementing parts of ten digits number by parts

I have number in file which contains date and serial number: 2013101000. The last two digits are serial number (00). So maximum of serial number is 100. After reaching 100 it becomes 00 with incrementing 10 which is day with max 31. after reaching 31 it becomes 00 and increments 10... (31 Replies)
Discussion started by: Natalie
31 Replies

10. UNIX for Beginners Questions & Answers

Incrementing the New File Version Number

Hi, This is my first post here. I am using cygwin on Windows 7. I am starting with a data file with filename "name_1.ext", like "20180831_snapgenotypes_1.csv". The "_1" before ".ext" is a version number. Integers (0-99) are sufficient. They don't have to be like "1.0.0". The filename may... (2 Replies)
Discussion started by: minimalist
2 Replies
curl_getenv(3)							  libcurl Manual						    curl_getenv(3)

NAME
curl_getenv - return value for environment name SYNOPSIS
#include <curl/curl.h> char *curl_getenv(const char *name); DESCRIPTION
curl_getenv() is a portable wrapper for the getenv() function, meant to emulate its behaviour and provide an identical interface for all operating systems libcurl builds on (including win32). AVAILABILITY
This function will be removed from the public libcurl API in a near future. It will instead be made "available" by source code access only, and then as curlx_getenv(). RETURN VALUE
If successful, curl_getenv() returns a pointer to the value of the specified environment. The memory it refers to is malloc()ed so the application must free() this when the data is no longer needed. When curl_getenv(3) fails to find the specified name, it returns a null pointer. NOTE
Under unix operating systems, there isn't any point in returning an allocated memory, although other systems won't work properly if this isn't done. The unix implementation thus has to suffer slightly from the drawbacks of other systems. SEE ALSO
getenv(3C), libcurl 7.12 30 April 2004 curl_getenv(3)
All times are GMT -4. The time now is 11:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy