Combine Column with remove zero


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Combine Column with remove zero
# 1  
Old 02-09-2012
Bug Combine Column with remove zero

Hi

My Input in in File 1
Code:
ABCDE2012 ABCDE2012         12       00    -099.8   -099.4   00.4     38.7      A:92/B:92                                    
ABCDE2012 ABCDE2012         12       04    -104.6   -103.6   01.0     36.8      A:94/B:94                                    
ABCDE2012 ABCDE2012         12       08    -104.4   -103.1   01.4     34.5      A:92/B:92

i need output
Code:
ABCDE2012 ABCDE2012120    -099.8   -099.4   00.4                                         
ABCDE2012 ABCDE2012124    -104.6   -103.6   01.0                                        
ABCDE2012 ABCDE2012128    -104.4   -103.1   01.4

i want to remove first zero from column 3.and remove last two columns.

Thanks in Advance.

Last edited by Franklin52; 02-10-2012 at 03:39 AM.. Reason: Please use code tags for code and data samples, thank you
# 2  
Old 02-09-2012
Try:
Code:
awk '{print $1,$2$3substr($4,2,1),$5,$6,$7}' file

This User Gave Thanks to bartus11 For This Post:
# 3  
Old 02-09-2012
Bug

Thanks man its working fine..........
# 4  
Old 02-09-2012
if fixed width :
Code:
 cut -c1-19,21,22,25-44 yourfile

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk with sed to combine lines and remove specific odd # pattern from line

In the awk piped to sed below I am trying to format file by removing the odd xxxx_digits and whitespace after, then move the even xxxx_digit to the line above it and add a space between them. There may be multiple lines in file but they are in the same format. The Filename_ID line is the last line... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. Shell Programming and Scripting

awk to remove lines that do not start with digit and combine line or lines

I have been searching and trying to come up with an awk that will perform the following on a converted text file (original is a pdf). 1. Since the first two lines are (begin with) text they are removed 2. if $1 is a number then all text is merged (combined) into one line until the next... (3 Replies)
Discussion started by: cmccabe
3 Replies

3. Shell Programming and Scripting

Combine multiple rows based on selected column keys

Hello I want to collapse a file with multiple rows into consolidated lines of entries based on selected columns as the 'key'. Example: 1 2 3 Abc def ghi 1 2 3 jkl mno p qrts 6 9 0 mno def Abc 7 8 4 Abc mno mno abc 7 8 9 mno mno abc 7 8 9 mno j k So if columns 1, 2 and 3 are... (6 Replies)
Discussion started by: linuxlearner123
6 Replies

4. Shell Programming and Scripting

Remove the values from a certain column without deleting the Column name in a .CSV file

(14 Replies)
Discussion started by: dhruuv369
14 Replies

5. Shell Programming and Scripting

Remove the first character from the fourth column only if the column has four characters

I have a file as follows ATOM 5181 N AMET K 406 12.440 6.552 25.691 0.50 7.37 N ATOM 5182 CA AMET K 406 13.685 5.798 25.578 0.50 5.87 C ATOM 5183 C AMET K 406 14.045 5.179 26.909 0.50 5.07 C ATOM 5184 O MET K... (14 Replies)
Discussion started by: hasanabdulla
14 Replies

6. Shell Programming and Scripting

remove brackets and put it in a column and remove repeated entry

Hi all, I want to remove the remove bracket sign ( ) and put in the separate column I also want to remove the repeated entry like in first row in below input (PA156) is repeated ESR1 (PA156) leflunomide (PA450192) (PA156) leflunomide (PA450192) CHST3 (PA26503) docetaxel... (2 Replies)
Discussion started by: manigrover
2 Replies

7. Shell Programming and Scripting

need to remove duplicates based on key in first column and pattern in last column

Given a file such as this I need to remove the duplicates. 00060011 PAUL BOWSTEIN ad_waq3_921_20100826_010517.txt 00060011 PAUL BOWSTEIN ad_waq3_921_20100827_010528.txt 0624-01 RUT CORPORATION ad_sade3_10_20100827_010528.txt 0624-01 RUT CORPORATION ... (13 Replies)
Discussion started by: script_op2a
13 Replies

8. Shell Programming and Scripting

Combine Multiple text or csv files column-wise

Hi All I am trying to combine columns from multiple text files into a single file using paste command but the record length being unequal in the different files the data is running over to the closest empty cell on the left. Please see below. What can i do to resolve this ? File 1 File... (15 Replies)
Discussion started by: venky_ibm
15 Replies

9. UNIX for Dummies Questions & Answers

how to combine two files together, not by row buy by column

let's say, we have: x1.txt 1 2 3 4 5 6 x2.txt 7 8 9 10 11 12 is there a very simple command like 'cat' that can makes them combine into x3.txt : 1 2 7 8 3 4 9 10 5 6 11 12 Thanks so much for help me with the dummiest questions:o (4 Replies)
Discussion started by: kaixinsjtu
4 Replies
Login or Register to Ask a Question