Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Replace all decimal values in a column Post 302937125 by siya@ on Tuesday 3rd of March 2015 05:37:57 PM
Old 03-03-2015
Replace all decimal values in a column

Hi
My input file looks

Code:
String000002  GeneWise        CW     48945   49354   .       -       0       Pt=PEQU_00004;
String000002  LEN   NA    52125   52604   0.945751        -       .       PID=PEQU_00005;lvid_id=PEQ_28708;
String000002  LEN   CW     52125   52604   .       -       0       Pt=PEQU_00005;
String000002  WEise        NA    66200   66667   45.48   -       .       PID=PEQU_00006;lvid_id=Os03t0797100-00-D1363;Shift=0;
String000002  WEise        CW     66200   66667   .       -       0       Pt=PEQU_00006;
String000002  GUST        NA    90829   91128   0.21    +       .       PID=PEQU_00007;lvid_id=A00088;
String000002  GUST        CW     90829   91128   0.21    +       0       Pt=PEQU_00007;
String000002  LEN   NA    104627  107284  0.499954        -       .       PID=PEQU_00008;lvid_id=PEQ_36749;
String000002  LEN   CW     104627  105584  .       -       1       Pt=PEQU_00008;

I want to replace all my 6th column entries to .

My original file has decimal values in column 6. It also has . as 6th column entries. I just want to replace all 6th column entries to .
I don't want to change the format or spacing of the file Need to retain the file spacing and format as it is.
My required output file is :

Code:
String000002  GeneWise        CW     48945   49354   .       -       0       Pt=PEQU_00004;
String000002  LEN   NA    52125   52604   .        -       .       PID=PEQU_00005;lvid_id=PEQ_28708;
String000002  LEN   CW     52125   52604   .       -       0       Pt=PEQU_00005;
String000002  WEise        NA    66200   66667   .   -       .       PID=PEQU_00006;lvid_id=Os03t0797100-00-D1363;Shift=0;
String000002  WEise        CW     66200   66667   .       -       0       Pt=PEQU_00006;
String000002  GUST        NA    90829   91128   .    +       .       PID=PEQU_00007;lvid_id=A00088;
String000002  GUST        CW     90829   91128   .    +       0       Pt=PEQU_00007;
String000002  LEN   NA    104627  107284  .        -       .       PID=PEQU_00008;lvid_id=PEQ_36749;
String000002  LEN   CW     104627  105584  .       -       1       Pt=PEQU_00008;

Is there a sed command that I could use?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

replace a column values with the first value in column

Hi All, I have a file which has data in following format: "Body_Model","2/1/2007","2/1/2007" "CSCH74","0","61" "CSCS74","0","647" "CSCX74","0","3" "CSYH74","0","299" "CSYS74","0","2514" "CSYX74","0","3" "Body_Model","3/1/2007","3/1/2007" "CSCH74","0","88" "CSCS74","0","489"... (3 Replies)
Discussion started by: sumeet
3 Replies

2. Shell Programming and Scripting

replace the column values.

I have the below file ...where some of the column values should replaced with desired values ....below file u can find that 3 column where ever 'AAA' comes should replaced with ' CC ' NOTE : we have to pass the column number ,AAA,CC (modified value) as the parameters to the code. ... (6 Replies)
Discussion started by: charandevu
6 Replies

3. UNIX for Dummies Questions & Answers

Replace values in a specified column of a file

Hello, I have a file with four columns and I would like to replace values in the second column only. An arbitrary example is: 100 A 105 B 200 B 205 C 300 C 305 D 400 D 405 E 500 E 505 F I need to replace the second column as shown below: ... (4 Replies)
Discussion started by: Gussifinknottle
4 Replies

4. UNIX for Dummies Questions & Answers

replace a column with values from another file

Dear all, I have a file1.pdb in pdb format and a dat file2 containing values, corresponding to the atoms in the pdb file. these values (file2.dat) need to be in the column instead of the 0.00 (file1) values for each atom in file1.pdb .(the red values must be replaced by the blue ones,in order)... (11 Replies)
Discussion started by: chen.xiao.po
11 Replies

5. Shell Programming and Scripting

Selective Replace awk column values

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)
Discussion started by: sdohn
3 Replies

6. Shell Programming and Scripting

Rounding decimal values in a column

Hi, I wanted to round all the values in a column to nearest integer. I have multiple files with only two columns and I want to round values in column 2. e.g input_file A1 23.971578 A2 34.624976 A3 46.403446 A4 375 A5 1 A6 3 A7 ... (3 Replies)
Discussion started by: ashu0001
3 Replies

7. Shell Programming and Scripting

Replace column values from other file

I have one file as it has the following format File1 S No Site IP Address 1 Australia 192.168.0.1/26 2 Australia 192.168.0.2/26 3 Australia 192.168.0.3/26 I need awk/sed command to replace the column2 value ( under Site) with some other... (8 Replies)
Discussion started by: samaritan
8 Replies

8. Shell Programming and Scripting

Trying to get an awk script to replace values in column

I'm trying to make an awk script to compare values I've set as var1, var2, and var3 earlier in the script to the values in the userinputted column of four text files called Node1.txt, Node2.txt, Node3.txt, and Node4.txt and then replace the values in that userinputted column with either ttt or gcc,... (8 Replies)
Discussion started by: Eric1
8 Replies

9. Shell Programming and Scripting

Need to grep for decimal values only in the second column.

Hi, I have a file in which I need to print all the lines that have decimal values in the second column. The below prints all the decimal values from the second column but I need the complete line to be printed. cat hello.out | sed 's/ */:/g' | cut -d : -f 2 | ggrep -Eo "+\.+" Can you... (2 Replies)
Discussion started by: mohtashims
2 Replies

10. UNIX for Beginners Questions & Answers

Replace a numeric values in a certain column

Hi All, I am trying to replace a certain value from one place in a file . In the below file at position 35 I will have 8 I need to modify all 8 in that position to 7 I tried awk '{gsub("8","7",$35)}1' infile > outfile ----> not working sed -i 's/8/7'g' infile --- it is replacing all... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
asn1_write_value(3)						     libtasn1						       asn1_write_value(3)

NAME
asn1_write_value - API function SYNOPSIS
#include <libtasn1.h> int asn1_write_value(asn1_node node_root, const char * name, const void * ivalue, int len); ARGUMENTS
asn1_node node_root pointer to a structure const char * name the name of the element inside the structure that you want to set. const void * ivalue vector used to specify the value to set. If len is >0, VALUE must be a two's complement form integer. if len=0 *VALUE must be a null terminated string with an integer value. int len number of bytes of *value to use to set the value: value[0]..value[len-1] or 0 if value is a null terminated string DESCRIPTION
Set the value of one element inside a structure. If an element is OPTIONAL and you want to delete it, you must use the value=NULL and len=0. Using "pkix.asn": result=asn1_write_value(cert, "tbsCertificate.issuerUniqueID", NULL, 0); DESCRIPTION FOR EACH TYPE
INTEGER
VALUE must contain a two's complement form integer. value[0]=0xFF , len=1 -> integer=-1. value[0]=0xFF value[1]=0xFF , len=2 -> integer=-1. value[0]=0x01 , len=1 -> integer= 1. value[0]=0x00 value[1]=0x01 , len=2 -> integer= 1. value="123" , len=0 -> integer= 123. ENUMERATED
As INTEGER (but only with not negative numbers). BOOLEAN
VALUE must be the null terminated string "TRUE" or "FALSE" and LEN != 0. value="TRUE" , len=1 -> boolean=TRUE. value="FALSE" , len=1 -> boolean=FALSE. OBJECT IDENTIFIER
VALUE must be a null terminated string with each number separated by a dot (e.g. "1.2.3.543.1"). LEN != 0. value="1 2 840 10040 4 3" , len=1 -> OID=dsa-with-sha. UTCTIME
VALUE must be a null terminated string in one of these formats: "YYMMDDhhmmssZ", "YYMMDDhhmmssZ", "YYMMDDhhmmss+hh'mm'", "YYMMDDhh- mmss-hh'mm'", "YYMMDDhhmm+hh'mm'", or "YYMMDDhhmm-hh'mm'". LEN != 0. value="9801011200Z" , len=1 -> time=Jannuary 1st, 1998 at 12h 00m Greenwich Mean Time GENERALIZEDTIME
VALUE must be in one of this format: "YYYYMMDDhhmmss.sZ", "YYYYMMDDhhmmss.sZ", "YYYYMMDDhhmmss.s+hh'mm'", "YYYYMMDDhhmmss.s-hh'mm'", "YYYYMMDDhhmm+hh'mm'", or "YYYYMMDDhhmm-hh'mm'" where ss.s indicates the seconds with any precision like "10.1" or "01.02". LEN != 0 value="2001010112001.12-0700" , len=1 -> time=Jannuary 1st, 2001 at 12h 00m 01.12s Pacific Daylight Time OCTET STRING
VALUE contains the octet string and LEN is the number of octets. value="$ssh$x01$ssh$x02$ssh$x03" , len=3 -> three bytes octet string l l l GENERALSTRING
VALUE coctains tce generclstring and LEN is the number of octets. k k k value="$ssh$x01$ssh$x02$ssh$x03" , len=3 -> three bytes generalstring l l l BIT STRING
VALUE coctains the bit string organized by bytes and LEN is the number of bits. k value="$ssh$xCF" , len=6 -> bit string="110011" (six bits) l CHOICE
if NAME indicates a choice type, VALUE must specify one of the alternatives with a null terminated string. LEN != 0. Using "pkix.asn" result=asn1_write_value(cert, "certificate1.tbsCertificate.subject", "rdnSequence", 1); ANY
VALUE indicates the der encoding of a structure. LEN != 0. SEQUENCE OF
VALUE must be the null terminated string "NEW" and LEN != 0. With this instruction another element is appended in the sequence. The name of this element will be "?1" if it's the first one, "?2" for the second and so on. Using "pkix.asn" result=asn1_write_value(cert, "certificate1.tbsCertificate.subject.rdnSequence", "NEW", 1); SET OF
the same as SEQUENCE OF. Using "pkix.asn": result=asn1_write_value(cert, "tbsCertificate.subject.rdnSequence.?LAST", "NEW", 1); RETURNS
ASN1_SUCCESS if the value was set, ASN1_ELEMENT_NOT_FOUND if name is not a valid element, and ASN1_VALUE_NOT_VALID if ivalue has a wrong format. COPYRIGHT
Copyright (C) 2006-2013 Free Software Foundation, Inc.. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. SEE ALSO
The full documentation for libtasn1 is maintained as a Texinfo manual. If the info and libtasn1 programs are properly installed at your site, the command info libtasn1 should give you access to the complete manual. libtasn1 3.3 asn1_write_value(3)
All times are GMT -4. The time now is 11:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy