Hello, I need help in appending the line number of each line to the file and also to get the total number of lines. Can somebody please help me.
I have a file say:
abc
def
ccc
ddd
ffff
The output should be:
Instance1=abc
Instance2=def
Instance3=ccc
Instance4=ddd
Instance5=ffff
... (2 Replies)
I have a file with a list of config files numbered on the lefthand side 1-300. I need to have bash read each lines number and assign it to a variable so it can be chosen by the user called by the script later.
Ex. 1 some data
2 something else
3 more stuff
which number do you... (1 Reply)
I have a file with contents similar to this.
abcd
1234
4567
7666
jdjdjd
89289
9382
92
jksdj
9823
298
I want to write a shell script which count the number of lines that start with the number (disregard the lines starting with alphabets) (1 Reply)
I have a set of log files that are in the following format
======= set_1 ========
counter : 315
counter2: 204597
counter3: 290582
======= set_2 ========
counter : 315
counter2: 204597
counter3: 290582
======= set_3 ========
counter : 315
counter2: 204597
counter3: 290582
Is... (6 Replies)
Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count
The input file:
21 2341 A
21 2341 A
21 2341 A
21 2341 C
21 2341 C
21 2341 C
21 2341 C
21 4567 A
21 4567 A
21 4567 C
... (6 Replies)
So I have a file in the form
>
akdfvcnciejcndmdjfk
>
kdjkkkifjeeeeelfjfuf
>
fjfhchdejhfhfhfhfhfhf
>
skdkdhfhvnvncnccm
and I would like it to come out in the form
>1
akdfvcnciejcndmdjfk
>2
kdjkkkifjeeeeelfjfuf
>3
fjfhchdejhfhfhfhfhfhf (3 Replies)
Hello,
I am newbie to bash scripting. Could someone help me with the following.
I have log file with output as shown below
**************************LOG*************************
11/20/2013 9:11:23.64 Pinging xx.xx.xx.xx with 32 bytes of data:
11/20/2013 9:11:23.64 Reply from xx.xx.xx.xx:... (4 Replies)
I am trying to use awk skip each line with a ## or # and check each line after for STB= and if that value in greater than or = to 0.8, then at the end of line the text "STRAND BIAS" is written in else "GOOD".
So in the file of 4 entries attached.
awk tried:
awk NR > "##"' "#" -F"STB="... (6 Replies)
I've been struggling with this one for quite a while and cannot seem to find a solution for this find/replace scenario. Perhaps I'm getting rusty.
I have a file that contains a number of metrics (exactly 3 fields per line) from a few appliances that are collected in parallel. To identify the... (3 Replies)
I have a directory of files, I can show the number of lines in each file and order them from lowest to highest with:
wc -l *|sort
15263 Image.txt
16401 reference.txt
40459 richtexteditor.txt
How can I also print the number of unique lines in each file?
15263 1401 Image.txt
16401... (15 Replies)
Discussion started by: spacegoose
15 Replies
LEARN ABOUT CENTOS
pmnumberstr_r
PMNUMBERSTR(3) Library Functions Manual PMNUMBERSTR(3)NAME
pmNumberStr, pmNumberStr_r - fixed width output format for numbers
C SYNOPSIS
#include <pcp/pmapi.h>
const char *pmNumberStr(double value);
char *pmNumberStr_r(double value, char *buf, int buflen);
cc ... -lpcp
DESCRIPTION
pmNumberStr returns the address of a 8-byte buffer that holds a null-byte terminated representation of value suitable for output with fixed
width fields. The pmNumberStr_r function does the same, but stores the result in a user-supplied buffer buf of length buflen, which should
have room for at least 8 bytes.
The value is scaled using multipliers in powers of ``one thousand'' (the decimal ``kilo'') and has a bias that provides greater precision
for positive numbers as opposed to negative numbers.
The format depends on the sign and magnitude of value as follows (d represents a decimal digit):
+----------------------------------+---------+
| value range | format |
+----------------------------------+---------+
| > 999995000000000 | inf? |
|999995000000000 - 999995000000 | ddd.ddT |
| 999995000000 - 999995000 | ddd.ddG |
| 999995000 - 999995 | ddd.ddM |
| 999995 - 999.995 | ddd.ddK |
| 999.995 - 0.005 | ddd.dd |
| 0.005 - -0.005 | 0.00 |
| -0.005 - -99.95 | -dd.dd |
| -99.995 - -99995 | -dd.ddK |
| -99995 - -99995000 | -dd.ddM |
| -99995000 - -99995000000 | -dd.ddG |
| -99995000000 - -99995000000000 | -dd.ddT |
| < -99995000000000 | -inf? |
+----------------------------------+---------+
At the boundary points of the ranges, the chosen format will retain the maximum number of significant digits.
NOTES
pmNumberStr returns a pointer to a static buffer and hence is not thread-safe. Multi-threaded applications should use pmNumberStr_r
instead.
SEE ALSO printf(3)Performance Co-Pilot PCP PMNUMBERSTR(3)