I am unix newbie looking for a unix bash script that can make it easier to do my code work. we have a code number for each code block that we want to incrementally assign. We have 10000 of these and it is very laborious to do this one by one.
so what we want is start from the top of the file , look for '0000' or text below whatver number is in it. start Update with 0001 and next wherever there is number like '0000' and also has '.001' int he same line then the number repeats. .001 does not change. Example below.
If the number is more 9999 thats ok. but till 9999 it should have pad of 4 zeros 0000. Please help. no perl please. So when ever I run the script to a file, the output should have the numbers replaced inside the file or to the output file.
Last edited by Don Cragun; 08-03-2019 at 02:16 AM..
Reason: Add CODE and ICODE tags.
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT ULTRIX
adjtime
adjtime(2) System Calls Manual adjtime(2)Name
adjtime - correct the time to allow synchronization of the system clock
Syntax
#include <sys/time.h>
adjtime(delta, olddelta)
struct timeval *delta;
struct timeval *olddelta;
Description
The system call changes the system time, as returned by moving it backward or forward by the number of microseconds corresponding to the
timeval delta.
The time is maintained by incrementing it with a machine-dependent tick every clock interrupt. If delta is negative, the clock is slowed
down by incrementing it in smaller ticks until the correction is made. If delta is positive, a larger tick is used. Thus, the time is
always a monotonically increasing function. A time correction from an earlier call to may not be finished when is called again. If old-
delta is nonzero, then the structure pointed to will contain, upon return, the number of microseconds still to be corrected from the ear-
lier call.
This call can be used in time servers that synchronize the clocks of computers in a local area network. Such time servers would slow down
the clocks of some machines and speed up the clocks of others to bring them to the average network time.
The call is restricted to the superuser.
Note
Time is incremented in 3906-microsecond (us) ticks on RISC and 10000 us ticks on VAX. When is called with a delta less than 1 second, time
is incremented according to the following table until the time is corrected:
-------------------------------------------
Default Fast Slow
System Increment Increment Increment
-------------------------------------------
RISC 3906 us 3921 us 3891 us
VAX 10000 us 10001 us 9999 us
-------------------------------------------
Return Values
A return value of 0 indicates that the call succeeded. A return value of -1 indicates that an error occurred, and in this case an error
code is stored in the global variable errno.
Diagnostics
The following error codes may be set in errno:
[EFAULT] An argument points outside the process's allocated address space.
[EPERM] The process's effective user ID is not that of the super-user.
See Alsodate(1), gettimeofday(2)adjtime(2)