Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Swapping the columns of a text file for a subset of rows Post 302686831 by evelibertine on Wednesday 15th of August 2012 12:52:36 PM
Old 08-15-2012
Swapping the columns of a text file for a subset of rows

Hi,

I'd like to swap the columns 1 and 2 of a space-delimited text file but only for the first 1000 rows. How do I go about doing that? Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to changes rows to columns in a file

Hi, I have a small requirement in chainging the rows to columns. The below example.txt contains info as shown Name:Person1 Age:30 Name:Person2 Age:40 Name:Person3 Age:50 I want to make it displayed as hown below Name:Person1 Age:30 Name:person2 Age:40 Name:Person3 Age:50 I... (4 Replies)
Discussion started by: oracle123
4 Replies

2. Shell Programming and Scripting

Helping in parsing subset of text from a big results file

Hi All, I need some help to effectively parse out a subset of results from a big results file. Below is an example of the text file. Each block that I need to parse starts with "reading sequence file 10.codon" (next block starts with another number) and ends with **p-Value(s)**. I have given... (1 Reply)
Discussion started by: Lucky Ali
1 Replies

3. Shell Programming and Scripting

Convert columns to rows in a file

Hello, I have a huge tab delimited file with around 40,000 columns and 900 rows I want to convert columns to a row. INPUT file look like this. the first line is a headed of a file. ID marker1 marker2 marker3 marker4 b1 A G A C ... (5 Replies)
Discussion started by: ryan9011
5 Replies

4. Shell Programming and Scripting

Help swapping columns with AWK

Hi! Im trying to swap 2 columns in a file.The file format is: 'ColumnA','ColumnB' 'A1','A2' 'B1','B2' 'C1','C2' I tried to solve this using AWK, when I run this command: awk 'BEGIN {FS=OFS=","} {temp=$1; $1=$2; $2=temp} {print}' InFile.csv >> Outfile.csv What I get is this: ... (5 Replies)
Discussion started by: RedSpyder
5 Replies

5. UNIX for Dummies Questions & Answers

Extracting rows from a text file based on the values of two columns (given ranges)

Hi, I have a tab delimited text file with multiple columns. The second and third columns include numbers that have not been sorted. I want to extract rows where the second column includes a value between -0.01 and 0.01 (including both numbers) and the first third column includes a value between... (1 Reply)
Discussion started by: evelibertine
1 Replies

6. Shell Programming and Scripting

Deleting all the fields(columns) from a .csv file if all rows in that columns are blanks

Hi Friends, I have come across some files where some of the columns don not have data. Key, Data1,Data2,Data3,Data4,Data5 A,5,6,,10,, A,3,4,,3,, B,1,,4,5,, B,2,,3,4,, If we see the above data on Data5 column do not have any row got filled. So remove only that column(Here Data5) and... (4 Replies)
Discussion started by: ks_reddy
4 Replies

7. Shell Programming and Scripting

Creating subset of a file based on specific columns

Hello Unix experts, I need a help to create a subset file. I know with cut comand, its very easy to select many different columns, or threshold. But here I have a bit problem as in my data file is big. And I don't want to identify the column numbers or names manually. I am trying to find any... (7 Replies)
Discussion started by: smitra
7 Replies

8. Shell Programming and Scripting

Swapping columns in specific blocks

Hi all, I hope all you guys have a great new year! I am trying to swap 2 columns in a specific block of a file. The file format is: Startpoint: in11 (input port) Endpoint: out421 (output port) Path Group: (none) Path Type: max Point ... (5 Replies)
Discussion started by: jypark22
5 Replies

9. Shell Programming and Scripting

Converting columns of text to rows, with blank lines

I've spent the past hour trying different things and googling for this solution and cannot find the answer. Found variations of this, but not this exact thing. I have the following text, which is the output from our mainframe. Each field is on a separate line, with a blank line between each... (7 Replies)
Discussion started by: lupin..the..3rd
7 Replies

10. Shell Programming and Scripting

To group the text (rows) by similar columns-names in a file

As part of some report generation, I've written a script to fetch the values from DB. But, unluckily, for certain Time ranges(1-9.99,10-19.99 etc), I don't have data in DB. In such cases, I would like to write zero (0) instead of empty. The desired output will be exported to csv file. ... (1 Reply)
Discussion started by: kumar_karpuram
1 Replies
cheswapr.f(3)							      LAPACK							     cheswapr.f(3)

NAME
cheswapr.f - SYNOPSIS
Functions/Subroutines subroutine cheswapr (UPLO, N, A, LDA, I1, I2) CHESWAPR applies an elementary permutation on the rows and columns of a Hermitian matrix. Function/Subroutine Documentation subroutine cheswapr (characterUPLO, integerN, complex, dimension( lda, n )A, integerLDA, integerI1, integerI2) CHESWAPR applies an elementary permutation on the rows and columns of a Hermitian matrix. Purpose: CHESWAPR applies an elementary permutation on the rows and the columns of a hermitian matrix. Parameters: UPLO UPLO is CHARACTER*1 Specifies whether the details of the factorization are stored as an upper or lower triangular matrix. = 'U': Upper triangular, form is A = U*D*U**T; = 'L': Lower triangular, form is A = L*D*L**T. N N is INTEGER The order of the matrix A. N >= 0. A A is COMPLEX array, dimension (LDA,N) On entry, the NB diagonal matrix D and the multipliers used to obtain the factor U or L as computed by CSYTRF. On exit, if INFO = 0, the (symmetric) inverse of the original matrix. If UPLO = 'U', the upper triangular part of the inverse is formed and the part of A below the diagonal is not referenced; if UPLO = 'L' the lower triangular part of the inverse is formed and the part of A above the diagonal is not referenced. LDA LDA is INTEGER The leading dimension of the array A. LDA >= max(1,N). I1 I1 is INTEGER Index of the first row to swap I2 I2 is INTEGER Index of the second row to swap Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: September 2012 Definition at line 103 of file cheswapr.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.2 Tue Sep 25 2012 cheswapr.f(3)
All times are GMT -4. The time now is 02:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy