The most likely shells - ksh and bash - both can do this the following way:
First, extract from the file name the part you want to increment as a number,
Second, increment the isolated number,
Third: reconstruct the new filename with the number.
For instance, in ksh:
You probably got the gist of this and can adapt this procedure to your needs.
I'm trying to do a script that will look for a log file if it is already there change the name to another name.
I.E
if log.0 is there
rename to log.1
rename log.1 to log.2
rename log.2 to log.3 and so on.
Only thing is I got no idea where or what is the best command to use for this? ... (3 Replies)
hello i'm trying to figure out how to number a blank line. For instance this :
sed '/./=' file | sed '/./N; s/\n/ /'
gives me
1 aaaa
2 bbbbbb
4 cccccc
5 ffkkkfff
6 ffsdfdfs
I would like something like this:
1 aaaaa
2
3 bbbbbb
4
5 cccccc
And so... (6 Replies)
Hello everyone,
I want get numbered lines from a file. and i can do it with: sed = file.txt | sed "/./N; s/\n/ /" | sed -n "5,7p"
but the output that i get is something similar to:
5 line5
6 line6
7 line7
and i want something like this (with 2points after the number):
5:... (6 Replies)
Hi,
I have this large file and sometimes there are duplicates and I want to basically find them and figure how many there are.
So I have a file with multiple columns and the last column (9) has the duplicates.
eg.
yan
tar
tar
man
ban
tan
tub
tub
tub
Basically what I want to... (6 Replies)
let says, i have this number as 000002080, i want to add 1 to make it 000002081, and then i want to add 1 to 000002082, add 1 to 000002083, 84.
i=000002080
TOT=$(echo "scale=9; $i + 1" | bc)
echo $TOT
it shows 2081, i want to retain 000002081, 000002082, 000002082, 000002084. (2 Replies)
Hi,
All I need to do is number a file.
The file looks like this
>
JJJJJJJJJJJJJJJJJJJJJ
>
JKJKJKKKKKKJJJ
>
MMMMYKKKJKKK
what I want to do is number it so that theres a numerical value beside the >.
>1
JJJJJJJJJJJJJJJJJJJJJ
>2
JKJKJKKKKKKJJJ (2 Replies)
I'm not really sure how to explain this but I will try. In the attached file if $4=$4 and $5="-" then the last record is 1 and the one above that is 2, etc...
However, $4=$4 and $5="-" then the first record is 1 and the one below that is 2, etc...
"-" example:
chr10 90694830 90695123... (7 Replies)
Discussion started by: cmccabe
7 Replies
LEARN ABOUT OSF1
cdsuf
cdsuf(1) General Commands Manual cdsuf(1)NAME
cdsuf - read the System Use Fields from a System Use Area
SYNOPSIS
cdsuf [-s number] [-b] file
OPTIONS
The following options are available: Specifies the File Section for the System Use Area to be read. The numbering starts with one. If this
option is omitted the last File Section of that file is assumed. Copies all of the System Use Fields of the System Use Area from the CD-
ROM to standard output in binary format. The name of any file or directory within the CD-ROM file hierarchy.
DESCRIPTION
This command is used to access the System Use Fields of the System Use Area associated with a File Section of a file or directory on a Rock
Ridge formatted CD-ROM and to list its contents on standard output, following any Continuation Fields that may be present.
The output is formatted in the form of a table that contains an entry for each System Use Field in the System Use Area as recorded on the
CD-ROM. Each table entry has the fields Signature, Length, Version, and Data as specified in the System Use Sharing Protocol. If the -b
option is used, the contents of the full System Use Area are written to standard output in binary format as it is recorded on the CD-ROM.
RESTRICTIONS
The user must have read permission for file to execute the command successfully.
EXIT STATUS
The following exit values are returned: Successful completion. File not found, file is not a file or directory within a CD-ROM file hier-
archy, or access denied. File Section indicated by -s does not exist. File Section indicated by -s has no System Use Area.
SEE ALSO cd_suf(3)cdsuf(1)