Sponsored Content
Top Forums Shell Programming and Scripting Help needed editing text file using the terminal Post 302961753 by RudiC on Thursday 3rd of December 2015 08:01:11 AM
Old 12-03-2015
As there are "0" replicates, you've got 14 + 12 + 12 = 38 replicates per ID. Should the "0" be included?

Btw, why dont you do it entirely in a spread sheet?

Howsoever, would this come close to what you need?
Code:
awk     '
NR > 1  {LN[$1]; HD[$3,$2]; MX[$1,$3,$2] = $4}
END     {               printf "%10s", ""; for (i in HD) printf "%10s", i; print "";
         for (j in LN) {printf "%10s",j;   for (i in HD) printf "%10s", MX[j,i]; print ""}
        }
' SUBSEP=, file
              11,low     8,low   9,alpha     6,low   8,alpha   7,alpha     4,low    9,beta   6,alpha    8,beta   5,alpha     2,low    7,beta   4,alpha    6,beta   3,alpha     0,low    5,beta   2,alpha    4,beta   1,alpha    3,beta   0,alpha    2,beta    1,beta    0,beta  13,alpha    10,low  12,alpha  11,alpha  10,alpha   11,beta   10,beta     9,low     7,low     5,low     3,low     1,low
XLOC_000002         0  0.545685         0  0.777916         0  0.198545   2.57191         0         0         0         0   1.37854         0         0         0         0         0         0         0         0         0  0.377084         0  0.191399         0         0         0         0         0   1.18404   1.50002    2.2376    2.5607  0.551643  0.391041   2.43143    1.8105         0
XLOC_000001   5.78727   14.9347   12.1221   5.16253   9.99926   12.2629    8.2976   13.6802   13.2137   11.8768   6.38582   6.54958   7.86049   5.73344   7.86049   17.4901   9.45804   5.46127   15.5619   7.37831   10.3199   9.53999   10.3686   10.0826   11.2568   12.5359   7.36243   4.43241   7.43817     10.75   10.5121   9.03584   9.68721   9.66479    6.5954   5.60313   3.23738   9.54959

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

text file editing

Hi, I need some help in text manipulation. I have an input file like this: 7629 "WPCW 19 - CW/AM1, WPCB 40 - FAMN/CORNER, WPCB-DT1 50 - FAMN/CORNER, " W35AW - Various Shopping Pgms W41CF - TBN W47CV - TBN WLLS-LP 49 - AM1 WATCH WPXI 11 N & WPIX 11 CW 1234 "WPCW 19 - CW/AM1,... (26 Replies)
Discussion started by: injeti
26 Replies

2. UNIX for Dummies Questions & Answers

Live/real-time text-file updates in terminal

I want to have a terminal open and have something like a "repeating cat" command running in it for a certain text file (in particular /var/log/system.log). So my terminal will scan or cat the text file every so often or whenever the text file system.log gets written to by the system, it will... (1 Reply)
Discussion started by: guitarscn
1 Replies

3. Programming

Editing a specific liine of text file - C++

Is there any way to erase all the contents of a specific line of a text file and then write something on it? e.g. test.txt.old: qwert asdfg zxcbv=0 test.txt.new qwerty asdfg hello=0 is this possible with C++ ?:confused: (1 Reply)
Discussion started by: hakermania
1 Replies

4. OS X (Apple)

Editing System Preference in Terminal

Mac OS X 10.6: Leopard - I'm trying to create a script that will run on its own that can edit system preferences. I've done some digging, and found that a lot of system preference options are controlled by .plist files in ~/library/preferences, /library/preferences, and... (1 Reply)
Discussion started by: Jalaska13
1 Replies

5. Shell Programming and Scripting

KSH - help needed for creating a script to generate xml file from text file

Dear Members, I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input. The contents of a single cell of INFO column is like: Area:app - aam Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies

6. Shell Programming and Scripting

editing line in text file adding number to value in file

I have a text file that has data like: Data "12345#22" Fred ID 12345 Age 45 Wilma Dino Data "123#22" Tarzan ID 123 Age 33 Jane I need to figure out a way of adding 1,000,000 to the specific lines (always same format) in the file, so it becomes: Data "1012345#22" Fred ID... (16 Replies)
Discussion started by: say170
16 Replies

7. Shell Programming and Scripting

Convert vi editing to text editing

Dear Guru's I'm using Putty and want to edit a file. I know we generally use vi editor to do it. As I'm not good in using vi editor, I want to convert the vi into something like text pad. Is there any option in Putty to do the same ? Thanks for your response. Srini (6 Replies)
Discussion started by: thummi9090
6 Replies

8. Shell Programming and Scripting

Print Terminal Output Exactly how it Appears in the Terminal to a New Text File

Hello All, I have a text file containing output from a command that contains lots of escape/control characters that when viewed using vi or view, looks like jibberish. But when viewed using the cat command the output is formatted properly. Is there any way to take the output from the cat... (7 Replies)
Discussion started by: mrm5102
7 Replies

9. UNIX for Dummies Questions & Answers

Editing long text file

Good morning all, I have a machine running IRIX and I need to edit a text file on the terminal that is literally thousands of lines. Does anyone know the most efficient way to edit portions of files like these? Obviously simply using the vi command isn't going to work since I get a too many lines... (1 Reply)
Discussion started by: James C
1 Replies
clagtm.f(3)							      LAPACK							       clagtm.f(3)

NAME
clagtm.f - SYNOPSIS
Functions/Subroutines subroutine clagtm (TRANS, N, NRHS, ALPHA, DL, D, DU, X, LDX, BETA, B, LDB) CLAGTM Function/Subroutine Documentation subroutine clagtm (characterTRANS, integerN, integerNRHS, realALPHA, complex, dimension( * )DL, complex, dimension( * )D, complex, dimension( * )DU, complex, dimension( ldx, * )X, integerLDX, realBETA, complex, dimension( ldb, * )B, integerLDB) CLAGTM Purpose: CLAGTM performs a matrix-vector product of the form B := alpha * A * X + beta * B where A is a tridiagonal matrix of order N, B and X are N by NRHS matrices, and alpha and beta are real scalars, each of which may be 0., 1., or -1. Parameters: TRANS TRANS is CHARACTER*1 Specifies the operation applied to A. = 'N': No transpose, B := alpha * A * X + beta * B = 'T': Transpose, B := alpha * A**T * X + beta * B = 'C': Conjugate transpose, B := alpha * A**H * X + beta * B N N is INTEGER The order of the matrix A. N >= 0. NRHS NRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrices X and B. ALPHA ALPHA is REAL The scalar alpha. ALPHA must be 0., 1., or -1.; otherwise, it is assumed to be 0. DL DL is COMPLEX array, dimension (N-1) The (n-1) sub-diagonal elements of T. D D is COMPLEX array, dimension (N) The diagonal elements of T. DU DU is COMPLEX array, dimension (N-1) The (n-1) super-diagonal elements of T. X X is COMPLEX array, dimension (LDX,NRHS) The N by NRHS matrix X. LDX LDX is INTEGER The leading dimension of the array X. LDX >= max(N,1). BETA BETA is REAL The scalar beta. BETA must be 0., 1., or -1.; otherwise, it is assumed to be 1. B B is COMPLEX array, dimension (LDB,NRHS) On entry, the N by NRHS matrix B. On exit, B is overwritten by the matrix expression B := alpha * A * X + beta * B. LDB LDB is INTEGER The leading dimension of the array B. LDB >= max(N,1). Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: November 2011 Definition at line 145 of file clagtm.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.1 Sun May 26 2013 clagtm.f(3)
All times are GMT -4. The time now is 11:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy