Stack Exchange Network

Stack Exchange network consists of 174 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.

2
votes
3answers
31 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
54 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
62 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
34 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
488 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
263 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
136 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
31 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
60 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
27 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
54 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
75 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
92 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
36 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
60 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
300 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
50 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
419 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
15 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
16 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
62 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
291 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
56 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
85 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
190 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
67 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
299 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
24 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
90 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
46 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
90 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
73 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
181 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
78 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 ...
3
votes
1answer
99 views

merging files in a one dataframe

I have almost 160 txt files, each file has 7 columns and now i want to put that in one file. Each files 1st and 6th column data (Geneid, Length) is same so i just want that to be the 1st and 2nd ...
21
votes
3answers
10k views

Bash shell script output alignment

My script: date echo -e "${YELLOW}Network check${NC}\n\n" while read hostname do ping -c 1 "$hostname" > /dev/null 2>&1 && echo -e "Network $hostname : ${GREEN}Online${NC}" || ...
-1
votes
1answer
87 views

Bash script that can output specific parts of a tacacs file into columns

I'm trying to output parts of a tacacs file into a monthly report. Have tried doing it in python but my result still has errors, so I thought I'd try and see if there's a elegant solution within a ...
3
votes
1answer
101 views

Merge 2 huge files matching multiple columns and preserving the order (print matching and non-matching values) - scale up from awk

I'm having trouble with merging data from 2 files. It is genetic data with chromosome, position, reference and alternate alleles and I need to merge the files by matching all 4 of those columns - with ...
1
vote
2answers
162 views

How to print a specific column to a file if condition seen in multiple files?

I have a bunch of files (totally 2181 files; anacovis2_1_summary_betai_reg.out ~ anacovis2_2181_summary_betai_reg.out) like below: anacovis2_2_summary_betai_reg.out anacovis2_3_summary_betai_reg.out ...
4
votes
3answers
1k views

How to optimize script with NF and a for loop

I have several files, each one with different number of columns. I want to convert them to insert them in a database For example the file test01: 0001 000000000000001 john smith 45 500 0002 ...
1
vote
1answer
2k views

printing row-based data in a table format on Linux

I have the below data in a file: col1 col2 col3 subcol1 subcol2 subcol3 subcol4 subcol5 subcol6 col4 subcol7 subcol8 subcol9 subcol10 subcol11 subcol2 The ...
3
votes
1answer
253 views

How can I calculate the average of multiple columns with the same value for the first two columns?

I have a file of about 13 million lines like: Lat Long air_temp sst wind_speed wave_height wave_period 65.3 7.3 4.3 8.8 7.7 4 8 61.6 1.3 -9.99 8.8 9.8 4 7 61.2 1.1 -9.99 8.8 7....
1
vote
3answers
1k views

How to replace empty cells of a specific column

I have a file with many columns and some empty cells in different columns. I would like to replace the empty cells for NA only in the third column. My file: 1 id1 info 2 otherinfo 3 id2 4 ...
1
vote
0answers
106 views

Join two tables based on non-sharing values in chosen column

I have been using "Perl for biologists with little computer coding knowledge" from site called Scriptome (Harvard). It gives great Perl one-liners to achieve desired functions which runs on Unix ...
0
votes
1answer
80 views

Arrangement of column next to last Nth instance of delimiter

I have the following data in my file alice bob cathy david elon unix linux bsd I want output with only the last Nth instance of delimiter (ie. a space) being arranged Like for last instance of ...
2
votes
1answer
382 views

How to extend columns when export COLUMNS doesn't work

UPDATE: it appears to be related to GNU screen and termcap: see new clues at bottom. I'm running Bash 4.3 on a small embeddable device, and having a problem convincing it that I have more than 80 ...
3
votes
1answer
160 views

Copy a block of text to a specific point in another file

I'm trying to figure out how to move a block of text from one file to a specific point in another. I have a large amount of files that looks like this: H -9.92247800 1.33807800 -...
1
vote
3answers
91 views

How to separate first column content in different rows

I have the input data with 5 columns separate by tabs: Class1,Class2 info1 info2 info3 info4 Class3 info1a info2a info3a info4a Class4,Class5 info1b info2b1,info2b2 info3b info4b When I have, in the ...
0
votes
1answer
112 views

how to delete rows with less than 2 columns in a data file in linux?

If the input look like this: 1 2 4 5 6 7 19 20 22 24 26 27 29 30 31 32 34 40 50 56 58 234 235 270 500 1234 1235 1236 1237 2300 I want to delete the rows with ...
1
vote
5answers
1k views

how to add multiple space between columns in Unix

I have a file looks like this 0 1 2 3 4 1 0 0 1 2 3 5 0 1 0 0 I want to add more (multiple) space between the columns and get something like this 0 1 2 3 4 1 2 3 ...