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.
343 questions
4
votes
3
answers
220
views
Add columns from variable number of files to base file
I'm dealing with a series of bed files, which look like this:
chr1 100 110 0.5
chr1 150 175 0.2
chr1 200 300 1.5
With the columns being chromosome, start, end, score. I have multiple different files ...
1
vote
1
answer
26
views
column command can't process null separator
I can get column to use tab as a field separator:
$ printf "a\tb\tc\n" | column -s $'\t' -t
a b c
But using null separator doesn't seem to work:
$ printf "a\0b\0c\n" | column -s ...
0
votes
5
answers
845
views
command-line tool to sum the values in a column of a CSV file
I am looking for a command-line tool to calculate the sum of the values in a specified column of a CSV file. (Update: The CSV file might have quoted fields, so a simple solution just to break on a ...
1
vote
5
answers
103
views
how to columnate list of strings in two lines, aligned to the length of the first column
I have a list of strings:
python2-distutils-extra|==>|python2-distutils-extra|2.39-5|Enhancements to the Python build system
python2-fuse|==>|python2-fuse|1.0.5-1|This is a Python 2 interface to ...
2
votes
1
answer
146
views
What is the purpose of the column with the '0' after the numeric timestamp in .zsh_history?
What is the purpose of the column with 0 after the numeric timestamp in .zsh_history?
: 1568128379:0;cp -a ~/.zshrc.pre-oh-my-zsh ~/.zshrc
: 1568128381:0;exit
Is it part of the timestamp or does it ...
0
votes
1
answer
195
views
handling columns with whitespaces
A hashing command gives the hash and the path separated by a whitespace:
k3j48fajsdjf4w8fj path to file/file 1.txt
I want to create a table where one column is the hash and the other column is the ...
4
votes
3
answers
2k
views
Visually aligning columns of a CSV file
Using sed or awk, is it possible to visually align columns in a CSV file?
For example:
e.g. from:
a,b,c,some stuff,"some, other, stuff",d,2023-03-10 18:37:00
y,x,z,t,cool,thing,2022-04-12 21:...
-1
votes
1
answer
75
views
How can I format the output of a shell command into columns, but limit the number of columns created?
Say I run
systemctl | grep running | column -t
I get an output that looks like this:
init.scope loaded active running System and Service Manager
session-...
-1
votes
4
answers
89
views
column(1) drops blank leading cells; is it fixable?
Consider this usage of column(1):
column -s, -t <<CSV
a,b,c
,ee,ff
CSV
The above snippet emits:
a b c
ee ff
But I was expecting to see something like this:
a b c
ee ff
column ...
2
votes
1
answer
60
views
rs(1) prints all output in a single line; how to duplicate the input array shape?
Consider this usage of rs(1):
rs -n -z -c, <<CSV
a,b,c
dd,ee,ff
CSV
The above snippet emits:
a b c dd ee ff
But I was expecting to see something like this:
a b c
dd ee ff
The ...
0
votes
4
answers
232
views
output a column group by another columns in shell
Thanks in advance!
I have a file with 3 columns like this:
serv1 red group1
serv1 black group1
serv1 orange group1
serv1 red group2
serv1 orange group2
serv1 red group3
...
0
votes
0
answers
185
views
Removing duplicate values based on two columns
I have a file that would like to filter duplicate values based column 1 and 6
ID,sample,NAME,reference,app_name,appession_id,workflow,execution_status,status,date_created
1,ABC,XYZ,DOP,2022-08-18 13:...
1
vote
2
answers
329
views
Converting column of values from positive to negative
I have an XYZ file, most of the Z values are positive but in fact should be negative. I am wanting to convert all positive values in column three to negative (keeping values already negative the same)....
2
votes
2
answers
892
views
Applying function to first column and inserting it as second
So I have been searching like crazy, but I still have not found a satisfactory solution. I have some output which looks like the following
kdeconnec 1625 1000 11u IPv6 414426 0t0 UDP *:...
2
votes
4
answers
650
views
Combine columns into one column (stack)
I have multi-column data that I wish to reformat such that each column follow "on top" of each other in one single column.
Example input:
1 2 3 4
1 2 3 4
Desired output: (fixed old ...