Questions tagged [table]
69 questions
100
votes
16 answers
sort but keep header line at the top
I am getting output from a program that first produces one line that is a bunch of column headers, and then a bunch of lines of data. I want to cut various columns of this output and view it sorted according to various columns. Without the headers,…
jonderry
- 2,039
- 4
- 19
- 19
72
votes
7 answers
combine text files column-wise
I have two text files. The first one has content:
Languages
Recursively enumerable
Regular
while the second one has content:
Minimal automaton
Turing machine
Finite
I want to combine them into one file column-wise. So I tried paste 1 2 and its…
Tim
- 98,580
- 191
- 570
- 977
28
votes
2 answers
Which order is the route table analyzed in?
On my PC I have to following routing table:
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 …
zer0uno
- 1,273
- 4
- 16
- 15
9
votes
2 answers
Issue with column command and color escape codes
I'm colorizing the header of a table formatted with column -ts $'\t'
Works well without color codes, but when I add color codes to the first line column doesn't properly align the output.
Without colored output it works as expected:
printf…
Niklas Berglund
- 225
- 4
- 9
5
votes
3 answers
Set alignment of numeric columns when columnating data
I use column -t to format data for easy viewing in the shell, but there seems to be no option to specify column alignment (e.g. align to the right).
Any Bash one-liners to do it? I have arbitrary number of columns.
Alex B
- 4,458
- 5
- 38
- 41
5
votes
0 answers
How can different file descriptors point to the same file in open file table?
Possible Duplicate:
How can same fd in different processes point to the same file?
I have a hard time grasping the two ideas of File Descriptor Table and Open File Table.
Open File Table is a table in kernel with all open files in the system, I…
Pithikos
- 3,214
- 4
- 23
- 27
5
votes
3 answers
Split a line into columns with some of the columns right-justified?
Is there an easy way to split comma-delimited lines of text into columns with some of the columns right-justified?
As a bonus, it would be nice to format numbers, but this probably isn't too hard with sed.
jonderry
- 2,039
- 4
- 19
- 19
4
votes
3 answers
Bash output array in table
I'm quite new at bash and I am trying to learn it by creating some small scripts.
I created a small script to look up the DNS entry for multiple domains at the same time. The domains are given as attributes.
COUNTER=0
DOMAINS=()
for domain in…
Matt Backslash
- 203
- 1
- 2
- 7
4
votes
3 answers
Leap year - extrapolating value
I have some tables (table.txt) as follow:
YEAR MONTH DAY RES
1971 1 1 1345
1971 1 2 1265
1971 1 3 1167
The length of each time series goes from 1.1.1971 until 31.12.2099. Unfortunately, some time series are missing leap years and…
steve
- 548
- 1
- 5
- 17
4
votes
2 answers
Sorting a CSV file, but not it's header
I need to sort a CSV file, but the the header row (1st row) keeps getting sorted.
This is what I'm using:
cat data1.csv | sort -t"|" -k 1 -o data1.csv
Here's a sample line:
Name|Email|Country|Company|Phone
Brent Trujillo|[email protected]|Burkina…
Frank Wilson
- 79
- 1
- 2
- 11
4
votes
1 answer
How to paste an HTML table into Libre Office Calc without losing structure
I want to paste an HTML table into Libre Office Calc. The HTML table rows contain images (in column 1) that should stay with their appropriate row. However, when I paste my HTML into Calc, the images are not pasted into rows but are free floating on…
MountainX
- 17,168
- 59
- 155
- 264
3
votes
4 answers
separate a file into several small files according to columns
I have a data file, which can have N rows, and each row is composed M elements separated by white space. Currently, I want to separate each row into several segments. In other words, assume the number of segments is 3; then the original file will…
user288609
- 641
- 3
- 8
- 16
3
votes
3 answers
Delete columns that sum to zero
I have a numeric table, that is all cells have numbers. It is a tab-delimited file, with non-numeric headers and row names. I need to delete all columns that add up zero. I would like to keep the first column (row names), and the headers of the rest…
fibar
- 41
- 6
3
votes
3 answers
Reformat tables
I have some tables (table.txt) that have been wrongly built and present redundancey in the results, as follow:
YEAR MONTH DAY RES
1971 1 1 245
1971 1 2 587
...
1971 12 31 685
1971 1 1 245
1971 1 2 587
...
1971 12 31 …
steve
- 548
- 1
- 5
- 17
3
votes
4 answers
Convert floating point numbers to decimal numbers
I have several 'ascii' tables in a directory, some of them have numbers expressed in decimal and some others ones in floating point, as follow:
1 1 1423
1 2 1589
1 3 0.85e 5
1 4 0.89e 4
1 5 8796
...
Is there a way to convert all the value of the…
steve
- 548
- 1
- 5
- 17