Sponsored Content
Full Discussion: to delete a column in unix
Top Forums UNIX for Dummies Questions & Answers to delete a column in unix Post 302099442 by c2b2 on Tuesday 12th of December 2006 06:14:01 AM
Old 12-12-2006
Bug

Lets assume that your input filename is infile.txt
Here is the code that might solve your problem Smilie

cat -n infile.txt | cut -f1 | tr -d " " > tempfile2
cut -d" " -f1 infile.txt > tempfile1
cut -d" " -f3- infile.txt > tempfile3

paste -d" " tempfile1 tempfile2 tempfile3 > outfile.txt


Since we are not actually reading each, this program will run really very fast Smilie .

Does this serve the purpose?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

delete 7th column in unix

Hello., i have a file with 15 column. i want to remove the 7th column from the file. i am trying to use awk to delete the 7th column. can anyone help me how to do this thanks (6 Replies)
Discussion started by: pavan_test
6 Replies

2. Shell Programming and Scripting

Delete first row last column

Hi All, I am having following file and I want to delete 1 row last column. Current File Content: ================ procedure test421 put_line procedure test321 test421 procedure test521 test321 procedure test621 test521 Expected File Content: =========================== procedure... (3 Replies)
Discussion started by: susau_79
3 Replies

3. Shell Programming and Scripting

delete first column

Dear All, I need to delete the first column, which blank in the tab delimited file and i need to print all the other columns with out disturbing the format of the file. I have tried with the followings and its not working for my case awk '{$1=""}1' file > newfilecut -d, -f2- dataCan anyone... (6 Replies)
Discussion started by: Fredrick
6 Replies

4. Shell Programming and Scripting

for each different entry in column 1 extract maximum values from column 2 in unix/awk

Hello, I have 2 columns (1st column has multiple entries but the corresponding values in the column 2 may be the same or different.) however I want to extract unique values for each entry in column 1 by assigning the max value from column 2 SDF4 -0.211654 SDF4 0.978068 ... (1 Reply)
Discussion started by: Diya123
1 Replies

5. Shell Programming and Scripting

delete the same column

var1 var2 var3 var4 var5 var6.... A G A T G T G A A A A A A A A A A A G A G T A T let's call this "file1.txt" we can see that var2 and var5 have the idential values. I would like to make a script so that if any variables (could be more than 2) have the identical values, i want to... (4 Replies)
Discussion started by: johnkim0806
4 Replies

6. UNIX for Advanced & Expert Users

Copy a column to another column in UNIX fixedwidth file

Hi All, I have a fixedwidth file of length 3000. Now i want to copy a column of 4 chars i.e( length 1678-1681) to column 1127 – 1171 to the same file. Please let me know how can i achive using a single command in fixed width file. Also source column length is 4 chars and target column length... (4 Replies)
Discussion started by: kiranparsha
4 Replies

7. Shell Programming and Scripting

Delete a row if either of column value is zero

Hi, My input file is this way 1.1 0.0 2.4 3.5 7.9 1.8 22.3 4.7 8.9 0.9 1.3 0.0 3.4 5.6 0.0 1.1 2.2 0.0 0.0 1.1 0.0 0.0 3.4 5.6 I would like to delete the entire row, if either of 2nd and 3rd columns are 0.0. Please note that my values are all decimal values. So, my output would... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

8. Shell Programming and Scripting

Delete last characters in each column

I need to delete the last 11 characters from each number and they are all in the same line (each is in a different column): -6.89080901827020800000 3.49348891708562325136 1.47988367839905286876 -2.29707635413510400000 -3.49342364708562325136 -4.43758473239905286876 -2.29707635413510400000... (14 Replies)
Discussion started by: rogeriog.em
14 Replies

9. Shell Programming and Scripting

Delete part of a column

I want to delete a part of the 4th column from the given file below: <Text Text_ID="10155645315851111_10155645333076543" From="460350337461111" Created="2011-03-16T17:05:37+0000" use_count="123">This is the first text</Text> <Text Text_ID="10155645315851111_10155645317023456"... (2 Replies)
Discussion started by: my_Perl
2 Replies

10. UNIX for Beginners Questions & Answers

UNIX script to compare 3rd column value with first column and display

Hello Team, My source data (INput) is like below EPIC1 router EPIC2 Targetdefinition Exp1 Expres rtr1 Router SQL SrcQual Exp1 Expres rtr1 Router EPIC1 Targetdefinition My output like SQL SrcQual Exp1 Expres Exp1 Expres rtr1 Router rtr1 Router EPIC1 Targetdefinition... (5 Replies)
Discussion started by: sekhar.lsb
5 Replies
DB2_FIELD_DISPLAY_SIZE(3)						 1						 DB2_FIELD_DISPLAY_SIZE(3)

db2_field_display_size - Returns the maximum number of bytes required to display a column

SYNOPSIS
int db2_field_display_size (resource $stmt, mixed $column) DESCRIPTION
Returns the maximum number of bytes required to display a column in a result set. PARAMETERS
o $stmt - Specifies a statement resource containing a result set. o $column - Specifies the column in the result set. This can either be an integer representing the 0-indexed position of the column, or a string containing the name of the column. RETURN VALUES
Returns an integer value with the maximum number of bytes required to display the specified column. If the column does not exist in the result set, db2_field_display_size(3) returns FALSE. SEE ALSO
db2_field_name(3), db2_field_num(3), db2_field_precision(3), db2_field_scale(3), db2_field_type(3), db2_field_width(3). PHP Documentation Group DB2_FIELD_DISPLAY_SIZE(3)
All times are GMT -4. The time now is 09:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy