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
SG_LUNS(8)							     SG3_UTILS								SG_LUNS(8)

NAME
sg_luns - send the SCSI REPORT LUNS command SYNOPSIS
sg_luns [--decode] [--help] [--hex] [--maxlen=LEN] [--quiet] [--raw] [--select=SR] [--verbose] [--version] DEVICE DESCRIPTION
Send the SCSI REPORT LUNS command to the DEVICE and outputs the response. In the SPC-3 SCSI standard support for this command is mandatory. OPTIONS
Arguments to long options are mandatory for short options as well. -d, --decode decode logical unit numbers into their hierarchical parts. Interprets luns as described in SAM-3 when the HiSup bit is set in a standard INQUIRY's response. -h, --help output the usage message then exit. -H, --hex output response to this command in ASCII hex. -m, --maxlen=LEN where LEN is the (maximum) response length in bytes. It is placed in the cdb's "allocation length" field. If not given (or LEN is zero) then 65536 is used. The maximum value of LEN is 65536. -q, --quiet output ASCII hex rendering of each report lun, one per line. -r, --raw output response in binary (to stdout). -s, --select=SR this option sets the 'select report' field (SR) in the SCSI REPORT LUNS command. The default value is 0. When 0 is given (or this option is not specified) then the DEVICE should yield a list of luns addressable via this "I_T nexus" that use the following lun addressing methods: logical unit addressing, peripheral device addressing and flat space addressing. When 1 is given the DEVICE should yield a list of only "well known" logical units addressable via this "I_T" nexus. When 2 is given the DEVICE should yield all luns addressable via this "I_T" nexus. To simplify, for the I_T nexus associated with the DEVICE, the meanings of the SR values are: 0 : all luns excluding well known logical units 1 : well known logical units 2 : all luns Values greater than 2 are reserved (at SPC-4 (rev 8)). -v, --verbose increase the level of verbosity, (i.e. debug output). -V, --version print the version string and then exit. EXIT STATUS
The exit status of sg_luns is 0 when it is successful. Otherwise see the sg3_utils(8) man page. AUTHORS
Written by Douglas Gilbert. REPORTING BUGS
Report bugs to <dgilbert at interlog dot com>. COPYRIGHT
Copyright (C) 2004-2008 Douglas Gilbert This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- POSE. SEE ALSO
sg_inq(8) sg3_utils-1.26 April 2008 SG_LUNS(8)
All times are GMT -4. The time now is 02:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy