I'll try it out and get back to you. I am unfamiliar with awk, do you think you could give me a bit of an idea of what each part of the script is for?
All that the awk script does is convert a set of letter codes which encode the base 4 positional number system into a decimal number...much like the hexadecimal system does. So a string of letter codes like T or CA or GCT can be viewed as a base 4 number with the letters A C G T used to encode the numbers 0 1 2 3 as it would be in the base 4 number system. Now all that you have to do is convert a string of base 4 letter codes into a decimal number and that is all that the awk script I posted does.
So for ex. to convert TGC into a decimal number you would do...
Quote:
Originally Posted by Mince
Also, is it necessary to have A set as 0? I forgot to mention that 0 in the format I am converting it to means "no data."
Thanks again!
The reason for setting A to 0 is to create an encoded base 4 number system...so can you clarify what you mean by posting a sample of the input that means "no data".
Hi
I have a file in the foll. format
*RECORD*
*FIELD NO*
.......
.......
*FIELD TX*
Data
*FIELD AV*
Data
*FIELD RF*
*RECORD*
*FIELD NO*
.......
.......
*FIELD TX*
Data
*FIELD RF* (4 Replies)
using sed to replace a specific string on a specific line number using variables
this is where i am at
grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean
grep -n Destination... (2 Replies)
If I have a set of strings,
C21
F231
H42
1C10
1F113
and I want to isolate the ints following the char, what would the sed string be to find numbers after letters?
If I do,
*, I will get numbers after letters, but I am looking to do something like,
sed 's/*/\t*/g'
this will give me... (14 Replies)
I'm trying to update a text file via sed/awk, after a lot of searching I still can't find a code snippet that I can get to work.
Brief overview:
I have user input a line to a variable, I then find a specific value in this line 10th field in this case. After asking for new input and doing some... (14 Replies)
Dear board,
(I am trying to post this the 3rd time, seems there's some conflicts with my firefox with this forum, now use IE)
------
yes, I have searched the forum, but seems my ? is too complicated.
------------origianl file ---------------
\storage\qweq\ertert\ertert\3452\&234\test.rec... (4 Replies)
Hi, I have the following data:
2860377|"DATA1"|"DATA2"|"65343"|"DATA2"|"DATA4"|"11"|"DATA5"|"DATA6"|"65343"|"DATA7"|"0"|"8"|"1"|"NEGATIVE"
32340377|"DATA1"|"DATA2"|"65343"|"DATA2"|"DATA4"|"11"|"DATA5"|"DATA6"|"65343"|"DATA7"|"0"|"8"|"1"|"NEG-DID"... (3 Replies)
Hi Experts,
I am finding difficulty to get exact match:
file
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1
INTERFACE_NAME="lan3"
IP_ADDRESS="10.53.52.241"
SUBNET_MASK="255.255.255.192"
BROADCAST_ADDRESS=""
INTERFACE_STATE=""
DHCP_ENABLE=0
INTERFACE_NAME="lan3:1"... (6 Replies)
I have a file with hundreds of lines in it. I wanted to extract anything that matches the following:
KR followed by 4 digits:
example KR1201
cat list | sed "s///g"
Is the closest I've come, and obviously it is not what I want. This would remove all of the items that I want and leave me... (2 Replies)
Greetings. I have a three column file, and there are some numbers in the second column that are <1. However I need all numbers to be positive, thus need to replace all those numbers with just one. I feel like there must be a simple way to use awk to find these numbers and sed to replace but can't... (5 Replies)
Hi!
I found and then adapt the code for my pipeline...
awk -F"," -vOFS="," '{printf "%0.2f %0.f\n",$2,$4}' xxx > yyy
I add -F"," -vOFS="," (for input and output as csv file) and I change the columns and the number of decimal...
It works but I have also some problems... here my columns
... (7 Replies)
Discussion started by: echo manolis
7 Replies
LEARN ABOUT PHP
gmp_init
GMP_INIT(3) 1 GMP_INIT(3)gmp_init - Create GMP numberSYNOPSIS
GMP gmp_init (mixed $number, [int $base])
DESCRIPTION
Creates a GMP number from an integer or string.
PARAMETERS
o $number
- An integer or a string. The string representation can be decimal, hexadecimal or octal.
o $base
- The base. The base may vary from 2 to 36. If base is 0 (default value), the actual base is determined from the leading charac-
ters: if the first two characters are 0x or 0X, hexadecimal is assumed, otherwise if the first character is "0", octal is assumed,
otherwise decimal is assumed.
RETURN VALUES
A GMP number resource in PHP 5.5 and earlier, or a GMP object in PHP 5.6 and later.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.2 | |
| | |
| | The $base was extended from 2 to 36, to 2 to 62 |
| | and -2 to -36. |
| | |
+--------+---------------------------------------------------+
NOTES
Note
To use the extended base introduced in PHP 5.3.2, then PHP must be compiled against GMP 4.2.0 or greater.
EXAMPLES
Example #1
Creating GMP number
<?php
$a = gmp_init(123456);
$b = gmp_init("0xFFFFDEBACDFEDF7200");
?>
NOTES
Note
It is not necessary to call this function if you want to use integer or string in place of GMP number in GMP functions, like
gmp_add(3). Function arguments are automatically converted to GMP numbers, if such conversion is possible and needed, using the same
rules as gmp_init(3).
PHP Documentation Group GMP_INIT(3)