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.

Filter by
Sorted by
Tagged with
0
votes
3answers
85 views

Delete line if other line starts with current line (column wise)

I've got a file input.txt in the following tab delimited format: aaaa bbbb aaaa bbbb c aaaa bbbb c dd aaaa bbbb cc aaaa bbbb x aaaa bbbb xx dddd eeee dddd ...
1
vote
2answers
32 views

split the content of a specific column with variable number of strings [duplicate]

I need to print each "word" in the second column in a new line, copying the text in the first column in each new line. The columns are tab separated and all "words" in the second column start with "GO:...
1
vote
2answers
30 views

How to add a column with a number or string that changes every time it finds a number on other column?

I have a file with different columns (three in this simplified example). The rows contain data of different replicates (Replicate_A, Replicate_B, Replicate_C). However, there is not the same amount of ...
1
vote
2answers
52 views

Find value from array in one file, look up value in another file, and then use that value to find another and set as variable

So I have two files, file 1 looks like this: RR1.out RR2.out RR3.out RR4.out RR5.out RR6.out 45.7597 45.7646 45.4453 45.4448 45.2081 45....
0
votes
3answers
55 views

Counting columns in file with table format

I have a file with table format, that looks something like this: abc00000000 1 643301 643374 Ile AAT 0 0 80.6 abc00000000 2 1278112 1278193 Ser GCT 0 0 86.2 abc00000000 ...
0
votes
1answer
42 views

How to merge two files with common fields in specific columns

I have two files and I want to merge them in a way when some specific columns are the same, export those lines with all fields except one column, which to be the subtraction of the two files in that ...
2
votes
1answer
154 views

Make xxd display the the byte offset at the top column?

So Im using emacs which has a stupendous hexl-mode to view the byte offset in a file right over the hex values similar to: 87654321 0011 2233 4455 6677 8899 aabb ccdd eeff 0123456789abcdeff ...
1
vote
2answers
164 views

how to add new column with constant value in a text file

I have a large text file with several columns and want to add a new column (no matter where) with constant value of 10000 please help
0
votes
1answer
46 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
40 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
103 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
64 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
54 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
46 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
126 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
42 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
95 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
356 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
52 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 ...
3
votes
2answers
50 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
200 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
170 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
158 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
57 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
69 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
99 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
44 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
1k 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
715 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
782 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
2answers
121 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
29 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
174 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
131 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
329 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
42 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
106 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 ...
2
votes
2answers
1k 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
90 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
2k 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
19 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
112 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
407 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
62 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
113 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
329 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
87 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....
6
votes
4answers
417 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
29 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 ...