Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [columns]

Use this tag when describing a specific portion of a particular group of entries in a table or a matrix or any other structured data set which is vertically aligned.

0
votes
0answers
15 views

invert string in column preserving file content (awk)

I'd like to be able to parse a file with the following format: A B 1/1:0,13:13:39:.:.:418,39,0 1/1:0,25:25:75:.:.:806,75,0 (in this example, the file has 4 columns, tab-separated, and ...
0
votes
1answer
29 views

Average a column based on not sequential rows

I have several files like this: 38 CVBR1 14.8804 -24.6979 CVBV1 16.1739 -22.9142 CVBV2 16.1376 -22.8745 CVBV4 16.0818 -22.8148 CVBV5 16.0028 -22.7777 CVBV6 16.1640 -22.7128 CVFG1 14.8981 -24.4886 ...
0
votes
1answer
19 views

How to separate isql ouput columns with two tabs

I have a utility (a wrapper around isql) which executes sybase queries and gives output. I want to separate 2 columns with two tabs. The help for the utility reads: <-s> : resets the ...
2
votes
4answers
83 views

How to not display a column that has all NULL values in a file

I have a file that has let's say, 5 columns(obtained by redirecting the results of a Sybase select query). Each column is separated by a tab. I need to filter out the columns that have all NULLs. Any ...
1
vote
2answers
34 views

Merging csv files with Key columns

I need to write a shell script to merge csv files. Both the files have same columns with fixed number of columns designated as "Keys". If the Keys are same, then I want to merge them by adding the non ...
0
votes
2answers
48 views

Rearranging columns in UNIX/Linux

I have to move the unique key which is in 3rd column of each record to first column. Now based on this key each record has different total columns in it (means # of fields) File content is 10,,FH,...
1
vote
3answers
43 views

I want to empty one column, but I want to keep the header name in unix

I am using below command to empty the column but I want to keep the header row, how can I do it in the same command? awk -F "," '{$10="";}1' OFS="," InputFile.csv > test.csv
1
vote
2answers
52 views

Aligning columns using awk

I am trying to align these columns super+t sticky toggle super+Shift+space floating toggle super+Shift+r restart super+Shift+d mode $mode_launcher super+Shift+c reload super+r mode resize super+...
0
votes
1answer
29 views

Merge two texts with comparison of the rows and select one text's rows if some columns are similar

I have two different files which some rows of the two data measures a same thing. I want to have a merged output such that the rows of File1 will be the output row where the rows measures same thing (...
0
votes
3answers
57 views

awk or grep? - print keyword and following columns

I did some benchmarks and the output is a single file containing multiple results with the following format [blaaa] 1st run T/V N NB P Q Time ========================== 2 3 4 1 2 1....
0
votes
6answers
219 views

I have a table and I want to extract the row in reverse order of columns in shell script [closed]

The table looks like this: 1|Hunk|First|London 2|Hero|Second|London 3|Will|First|Pow 4|Thomas|Second|Pow 5|Venus|First|Berlin I want to print the output as: Berlin|First|venus|5 i want to print ...
1
vote
2answers
50 views

How to generate a pivotal table?

I have a file which looks like this: latitude Chr01 0.85 latitude Chr05 0.25 latitude Chr11 0.07 latitude Chr13_a 0.26 latitude Chr13_b 0.00 latitude Chr14_a 0.00 latitude Chr14_b 1 latitude Chr15 1 ...
2
votes
1answer
32 views

Print table with empty columns for consecutive delimiters

I typically use column to convert input into a table, eg: $ echo 'a\tb\tc\nd\te\tf' | column -t -s $'\t' a b c d e f However it collapses empty columns eg: $ echo 'a\tb\tc\nd\t\tf' | column -t -...
0
votes
1answer
100 views

Find, grep and then create table

I am trying to find all *.md at ${PWD}, then grep for lines beginning with title: and print it along with the absolute filepath -H and the line number of the pattern match -n, then I try to output the ...
4
votes
1answer
161 views

Sort multiple delimited file lexicographically by one column, numerically by another

I wish to sort the TSV file below (called min_ex) by the first column lexicographically and by the second column numerically. A X, N 2.2 A, N 5.7 A, A 5.8 A, N 2.1 A, T 0.2 B G, M 2....
0
votes
3answers
62 views

Get a certain column of an output with content aligned right and some columns not always filled

This is a problem I often encounter, this time with the output of lsof, but I am searching for a general solution for such problems: selecting a column. Here I try to get the TYPE column of the ...
2
votes
3answers
48 views

Split content of specific columns when specific characters are present in those columns

I have this data tab delimited: ed00011 89 0.12 NA NA No ed0002s 28 0.11 c3(3.1e-1) NA No ed0001 22 0.37 NA ...
1
vote
2answers
64 views

How do I align columns at common elements but give differing elements their own rows?

I am using paste to merge three text files (which do not require sorting) into a single document with three columns. paste a.txt b.txt c.txt I'd like elements that the columns have in common to ...
0
votes
1answer
89 views

To compare column1 of two files

I need to compare the column 1 of file 1 with the column 1 of file2 in my script, if the column 1 of file1 matches with the column 1 of file2, then only it should proceed further ,else exit. I'm with ...
1
vote
2answers
40 views

Printing a file in columns with arbitrary amount of rows

I have this file: line1 line2 line3 line4 line5 line6 line7 line8 line9 And I want to print it across 3 columns with this structure so that first column has lines 1-2-3, second column has the lines ...
3
votes
4answers
913 views

cut / grep df -h [duplicate]

How can I get the mount point "3.1T" under the column " Avail" (using grep or cut)? Filesystem Size Used Avail Use% Mounted on vstorage://cluster07 4.0T ...
2
votes
2answers
583 views

Calling an array inside awk to create a table with fixed-width columns

I would like to extract data from a file and organize it in a big fixed-widths table. I can expect that this table will have multiple columns, let's say 30 columns. If I create this table using the ...
1
vote
1answer
548 views

Switch columns in CSV using awk? [duplicate]

I have the exact same question as this one here. Only difference is I have 3 columns only and I am trying to move the 1st column to the end. The original file looks like this: col1,col2,col3 2,2015-...
0
votes
0answers
43 views

Can coreutils' `pr` do what util-linux's `column` can do?

Can coreutils' pr do what util-linux's column can do: The column utility formats its input into multiple columns. The util support three modes: columns are filled before rows ...
0
votes
2answers
106 views

Remove and replace column

I have a file which looks like this: 1 1 2 5.24 3 12.46 4 21.56 and so on. I need to change it to: 1 1 3 5.24 5 12.46 7 21.56 on a quick way. So the first column has to have odd values 2i+1 for i ...
0
votes
1answer
28 views

How to add the value of this column? (us+ sy+id+wa)

I want to find for the CPU Utilization. So, I am trying to add the us, sy, id, wa column.Is it possible to do the addition for those 4 column. Any suggestion? procs -----------memory---------- ---...
3
votes
3answers
103 views

search column 2 in csv file for value, if value, then insert “invalid” and shift cells right

I have csv file that is auto generated by a script but for some of the records (line items) received I need to search column 2 and if the values contains "*.app" I need to print "INVALID" into column ...
4
votes
1answer
106 views

How to display columns in tab separated files nicely?

I have some Tab separated files that consist of a header that are quite unreadable because of the different length of table entries. Essentially, it looks somewhat like c1 c2 c3 c4 A 0 ...
0
votes
2answers
219 views

Git-bash UNIX: Switch columns/fields using cut?

So I have a file with 2 columns as follows: 10 1 11 2 12 3 13 4 14 5 I would like to switch the columns using the cut command. I've used paste <(cut -f2 file.dat) <(cut -f1 ...
0
votes
1answer
40 views

merging files with the same 1 column

I have multiple files named p1.bbmap.mapping.csv, p2.bbmap.mapping.csv, p3.bbmap.mapping.csv ... p3.bbmap.mapping.csv Each file has two columns. p1_60_length_504_cov_1.580902 12 ...
1
vote
2answers
75 views

How to change values of one column using other column's values from a different file

I don't know what command should I use in unix. Let say I have a file like this: A 23 B 52 C 36 F 25 and second file with 3 columns: A aligator 2 B panda 3 C bear 4 D pig 1 E yeti 0 ...
1
vote
2answers
815 views

Aligning output in Linux paste command

How can I make the second file in a paste start in the same spot regardless of the length of the line in the first file? For example: file1: small incredibly humungous file 2: A B I want paste ...
0
votes
1answer
77 views

How to print multiple columns without truncating?

I know that pr -m -t file1 file2 will give me 2 columns like so: file1: a abc abcdefg abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz file2: 1 123 12345678 12345678901234567890 - $ pr -m -t ...
1
vote
4answers
1k views

Is it possible to put double quotes in just a few columns using sed?

I'm doing my course completion work where I need to manipulate some columns of a .csv file that has six hundred thousand lines. I have already searched in several forums on sed and awk and I did not ...
0
votes
1answer
16 views

How do I add the filename after the content of the first column?

This is my original file called NAME.xxx columnname1 columnname2 columnname3 XX_XX_XX_XX number number YY_YY_YY_YY number number ZZ_ZZ_ZZ_ZZ number number This is how I would like ...
1
vote
0answers
17 views

column Removes Whitespaces at Process Substitutions

I try to display two statistics of my nginx-server side-by-side. My first approach for this is column and process substitution. column <( echo "sorted by busiest access times:" ...
1
vote
2answers
100 views

Deleting end of line if column starts with character

I have a large file, where the second column has some lines that need to be truncated. Currently it is: 10 10:135524264:C:G 0 135524264 C G 10 rs55726203:135524334:A:G 0 135524334 A G If the second ...
3
votes
1answer
368 views

awk - dynamically format tab-separated columns

I have a file with dynamic length columns (four) separated with tabs (a column can have have spaces) COL1 COL2 COL2 COL2 COL3 COL3 COL4 COL1 COL2 COL2 COL3 COL4 COL4 COL1 COL1 ...
0
votes
1answer
61 views

Merging columns from 200+ big files into one table

I have 200+ large files that all have exactly 1 column and 76M rows. I want to start a newfile.txt and slap the columns next to each other (match Line 1 of File 1 with Line 1 of File 2... and continue ...
1
vote
1answer
92 views

How to change line width in “info” command

Is it possible to make lines in the info command wider? An example : When running info awk I get the following output, although the terminal size is much wider. 2 Running 'awk' and 'gawk' **********...
0
votes
1answer
275 views

Sum First Column on basis of Second Column

I have written a Bash script which stores the number of records(line count) in a file and File name which is present in the directory in a output.txt file. The output.txt file is as below. No....
2
votes
3answers
84 views

Merge columns and add

I have a file with the following content (there are additional spaces to pad the first column) 1 account1 192.168.0.1 1 account1 192.168.0.2 19 account2 192.168.0.1 100 account3 192.168....
5
votes
4answers
373 views

How to split field 1 into distinct rows but keep field 2 copied for each new row created

Input: Note: 2 columns separated by a tab, regular spaces separating words in column 2. 1 the mouse is dead 2 hit the wall 3 winter lasts forever Wanted output: 1 the 1 mouse 1 is 1 ...
-2
votes
3answers
28 views

Compare Columns of genes in file and output the gene and number of column it is present in linux

I have 3 coumns of genes in a file like this col1 col2 col3 CXCL9 CXCL9 CXCL9 MAP2K6 MAP2K6 MAP2K6 CXCL10 CXCL10 CXCL11 I want to match the 3 columns and see which gene is present in ...
1
vote
2answers
121 views

How to insert a column between two other columns of output?

Please note that I'm aware of this and this but they didn't help me. I want to combine the outputs of two commands. ls -1sh And wc -l so I can do something like: <combined command> o.img 1....
0
votes
1answer
61 views

How to merge two files containing lists to one file with two columns?

I have the file mail.txt which contains the list of some emails and the file names.txt that includes the names of those people accordingly. Now I want to combine these files to one files with the ...
2
votes
2answers
92 views

join returns nothing

I have two files with columns separated by tab and I want to merge them file a01 a= b= c= d= e= f= g= h= i= j= k= l= m= n= 0= file b01 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...
1
vote
3answers
87 views

sort File B based on column 3 of File A without changing contents of File A

I have the following file: cat fileA.txt seattle 1991 west atlanta 1993 west turlock 1998 west marysville 2004 south newyork 2007 north canada 2004 west And the second file ...
1
vote
3answers
461 views

Print only certain columns while maintaining white space

I have some code that prints select columns from the output of lsblk. However, the spacing in the result makes it hard to read. Is there anyway to do this while maintaining the white space? echo "`...
2
votes
2answers
152 views

How to cut the last 5 strings in one particular column for all rows

I have a file with multiple columns and rows, and I need to cut the last 5 strings of my third column and print it in an extra column. For example: 1 info1 AAAAAAAAAAA 2 info23 TTTTTTTTTT 3 ingo45 ...