02-14-2015
Thank you Rudic, that is something to study on monday
The above is my - obviously with help - first awk 'script'.
So by the time i really got annoyed by the attempt to substr the proper number of chars of the numbers, to print 1 or 2 decimals (couldnt decide) after the dot, and the dot only if required there were uneven numbers.
So i came up with a solution using methods i knew or just learned and did the job i wanted
Since i had problems to get the amount of full numbers before the dot, to the remove them and the dot, to just use the first (two) char/s then to display, i used split to get full and uneven (decimal) numbers and did just the same, with the 'extracted' string in the array.
Have a good weekend
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
My file has 2 fields and millions of lines.
variableStep chrom=Uextra span=25
201 0.5952
226 0.330693
251 0.121004
276 0.0736858
301 0.0646982
326 0.0736858
401 0.2952
426 0.230693
451 0.221004
476 0.2736858
Each field either has a... (6 Replies)
Discussion started by: wyarosh
6 Replies
2. UNIX for Dummies Questions & Answers
Hi !
Just wondering, is it possible to color or highlight or underline a matching pattern with awk ?
Or write it in bold, italic.....? (3 Replies)
Discussion started by: lucasvs
3 Replies
3. Shell Programming and Scripting
I am trying to do some math, so that I can compare the average of six numbers to a variable.
Here is what it looks like (note that when I divide really big numbers, it isn't a real number):
$ tail -n 6 named.stats | awk -F\, '{print$1}'
1141804
1140566
1139429
1134210
1084682
895045... (3 Replies)
Discussion started by: brianjb
3 Replies
4. Shell Programming and Scripting
hi I want to write a script, while using the SED editor, to output the text, in this case a variable, to the result file but highlighted it in bold, is it possible to do that? can you tell me how?
eg. in text.txt
sed '$ a\
'$variable'
' <text.txt >text2.txt
so it will add the... (2 Replies)
Discussion started by: piynik
2 Replies
5. Shell Programming and Scripting
Hi I have this list
592;1;Z:\WB\DOCS;/FS3_100G/FILER112/BU/MPS/DOCS;;;;\\FILER112\BUMPS-DOCS\;580,116,544,878 Bytes;656,561 ;77,560
592;2;Z:\WB\FOCUS;/FS3_100G/FILER112/BU/MPS/FOCUS;;;;\\FILER112\BUMPS-FOCUS\;172,430 Bytes;6 ;0 ... (12 Replies)
Discussion started by: nakaedu
12 Replies
6. Shell Programming and Scripting
Based on input
ail,UTT,id1_0,COMBO,21,24,21,19,85
al,UTHAST,id1_0,COMBO,342,390,361,361,1454
and awk code as
awk -F, '{ K=0; for(i=NF; i>=(NF-4); i--) { K=K+$i; J=J+$i;} { print K } } END { for ( l in J ) printf("%s ",J); }'
I'm trying to add columns and lines in single line. line... (6 Replies)
Discussion started by: busyboy
6 Replies
7. Shell Programming and Scripting
Hi
main object is categorize the difference of data-values (TLUFT02B - TLUFT12B).
herefor i read out data-files which are named
acording to the timeformat yyyymmddhhmm.
WR030B 266.48 Grad 0
WR050B 271.46 Grad 0
WR120B 268.11 Grad 0
WV030B 2.51 m/s ... (6 Replies)
Discussion started by: IMPe
6 Replies
8. Shell Programming and Scripting
Hi expert,
I have log :
TOTAL-TIME : 2125264636
DATA-BYTES-DOWN : 3766111307032
DATA-BYTES-UP : 455032157567
DL = (3766111307032/2125264636)/1024 = 1.73
UL = (455032157567/2125264636)/1024 = 0.21
I want the result :
TOTAL = 1.94 ... (4 Replies)
Discussion started by: justbow
4 Replies
9. Shell Programming and Scripting
Hi expert,
i have log this:
Memory: 74410384
Memory: 75831176
Memory: 77961232
Memory: 77074656
Memory: 76086160
Memory: 77128592
Memory: 78045384
Memory: 76696040
Memory: 72401176
Memory: 72520016
Memory: 72137016
Memory: 73175832
Memory: 73034528
Memory: 71770736
Memory:... (4 Replies)
Discussion started by: justbow
4 Replies
10. What is on Your Mind?
FYI,
I'm slowly removing a lot of the bold font-styles from titles of discussions, forum titles, etc
I'm not removing bold for the entire site because we do need bold from time to time, especially in posts and sometimes in other places.
However, the original forum style had way too much... (3 Replies)
Discussion started by: Neo
3 Replies
LEARN ABOUT HPUX
inet_network
inet(3N) inet(3N)
NAME
inet: inet_addr(), inet_lnaof(), inet_makeaddr(), inet_netof(), inet_network(), inet_ntoa(), inet_ntoa_r() - Internet address manipulation
routines
SYNOPSIS
Remarks
The routine is described in the section below.
DESCRIPTION
Interpret character strings representing numbers
expressed in the Internet standard "dot" notation.
returns numbers suitable for use as Internet addresses.
returns numbers suitable for use as Internet network numbers.
Return values can be assigned to a (defined in by using a technique similar to the following:
Take an Internet address and return an
ASCII string representing the address in dot notation.
Take an Internet network number and a local network address
and construct an Internet address from it.
Break apart Internet host addresses,
returning the network number part.
Break apart Internet host addresses,
returning the local network address part.
All Internet addresses are returned in network order (bytes ordered from left to right). All network numbers and local address parts are
returned as machine-format integer values. Bytes in HP-UX systems are ordered from left to right.
Internet Addresses
Values specified using dot notation take one of the following forms:
When four parts are specified, each is interpreted as a byte of data and assigned, from left to right, to the four bytes of an Internet
address.
When a three-part address is specified, the last part is interpreted as a 16-bit quantity and placed in the right-most two bytes of the
network address. This makes the three-part address format convenient for specifying Class B network addresses, as in
When a two-part address is supplied, the last part is interpreted as a 24-bit quantity and placed in the right-most three bytes of the net-
work address. This makes the two-part address format convenient for specifying Class A network addresses as in
When only one part is given, the value is stored directly in the network address without any byte rearrangement.
All numbers supplied as parts in dot notation can be decimal, octal, or hexadecimal, as specified in the C language (i.e., a leading 0x or
0X implies hexadecimal; a leading 0 implies octal; otherwise, the number is interpreted as decimal).
In a multithreaded application, uses thread-specific storage that is re-used in each call. The return value, the character string, should
be unique for each thread and should be saved, if desired, before the thread makes the next call.
Obsolescent Interfaces
The following reentrant interface has been moved from to
It is included to support existing applications and may be removed in a future release. New multithreaded applications should use the reg-
ular API (those without the suffix.)
The reentrant interface functions the same as the regular interface without the suffix. However, expects to be passed the address of a
character buffer and will store the result at the supplied location. If the buffer is of insufficient length, is returned. If the opera-
tion is successful, the length of the result string (not including the terminating null character) is returned.
RETURN VALUE
The routines return values as described in the section. and return for malformed requests.
WARNINGS
The return value from the function cannot distinguish between a failure (and a local broadcast address (255.255.255.255). This can be han-
dled by using the function instead of the function.
AUTHOR
The routines were developed by the University of California, Berkeley.
SEE ALSO
gethostent(3N), getnetent(3N), inet6(3N), hosts(4), networks(4), thread_safety(5).
inet(3N)