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.
341
questions
0
votes
4
answers
87
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
94
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
138
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
129
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
1k
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
61
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
84
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
52
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
173
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
139
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
275
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
855
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
593
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 ...
0
votes
2
answers
95
views
how to add a number as well as format change to column value and print it in 3rd column
I have these two columns with header:
CHR BP
1 78901
I need to add a character to the first column numbers (chr). I also need to make a third column in which one score being added to the second ...
2
votes
1
answer
783
views
format to columns for real-time data (pipe)
Is there a way to do column-like filtering on data comming through a pipe?
I am looking for a way how to do a similar thing that column -t does, but without waiting for the input to end so it would ...