Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

6 votes
3 answers
7245 views
Set alignment of numeric columns when columnating data
I use [`column -t`][1] 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. [1]: https://unix.stackexchange.com/questions/17664/a-shell-tool-to-tablify-in...
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 (4598 rep)
Dec 12, 2011, 03:45 AM • Last activity: Jan 1, 2025, 11:12 AM
10 votes
3 answers
4126 views
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 "1\t2\t3\nasdasdasdasdasdasdasd\tqwe\tqweqwe\n" | c...
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 "1\t2\t3\nasdasdasdasdasdasdasd\tqwe\tqweqwe\n" | column -ts $'\t' But when adding color on the first line column **doesn't align** the text of the colored row: printf "\e[7m1\t2\t3\e[0m\nasdasdasdasdasdasdasd\tqwe\tqweqwe\n" | column -ts $'\t' Observed this behaviour both on Ubuntu Linux and Mac OS X.
Niklas Berglund (235 rep)
Dec 27, 2015, 09:23 AM • Last activity: Feb 22, 2024, 03:49 PM
0 votes
1 answers
498 views
How do I get the physical address of the page table?
I was trying to get the physical address of the **page table** itself, but kept failing. The last option I'm going to try, is to modify the kernel code and simply print out the physical address whenever the hierarchical page table is created or extended. However, is there a different way to check th...
I was trying to get the physical address of the **page table** itself, but kept failing. The last option I'm going to try, is to modify the kernel code and simply print out the physical address whenever the hierarchical page table is created or extended. However, is there a different way to check the physical address of the page table? Similar to the way of simply reading /proc/PID/pagemap for finding the virtual to physical mapping.
Michael Jaemin Kim (1 rep)
Jan 14, 2024, 10:54 PM • Last activity: Jan 15, 2024, 12:17 AM
-2 votes
1 answers
603 views
Template for formatting output as a dynamic table in bash
I have a created a simple script which is using the ps aux command to give information for a process entered by a user, and presents the output in a table like format (something like the mysql shell is doing for table format). This is working to some extent, the only problem is how to make the cells...
I have a created a simple script which is using the ps aux command to give information for a process entered by a user, and presents the output in a table like format (something like the mysql shell is doing for table format). This is working to some extent, the only problem is how to make the cells fit the content dynamically depending on the value's length. If a value is too long, it goes on a new line and breaks the table. Is there some smarter way to wrap the value within its cell? #!/bin/bash # Main function main() { read -p "Enter the name of the process: " process output=$(ps aux | awk -v process="$process" '$0 ~ process && !/awk/ {print}') if [ -n "$output" ]; then printf "+------------+------------+------------+------------+------------+----------------------------+\n" printf "| %-10s | %-10s | %-10s | %-10s | %-10s | %-100s |\n" "USER" "PID" "%CPU" "%MEM" "START" "COMMAND" printf "+------------+------------+------------+------------+------------+----------------------------+\n" echo "$output" | awk '{ printf "| %-10s | %-10s | %-10s | %-10s | %-10s | %-100s |\n", $1, $2, $3, $4, $9, substr($0, index($0,$11)) }' printf "+------------+------------+------------+------------+------------+----------------------------+\n" else echo "No such process found: $process" fi } # Call the main function main Current output from above: Enter the name of the process: bash +------------+------------+------------+------------+------------+----------------------------+ | USER | PID | %CPU | %MEM | START | COMMAND | +------------+------------+------------+------------+------------+----------------------------+ | userrt | 1072 | 0.0 | 0.1 | 09:04 | -bash | | userrt | 1438 | 0.0 | 0.0 | 09:04 | bash | | userrt | 1575 | 0.0 | 0.1 | 09:04 | /bin/bash --init-file /home/userrt/.vscode-server/bin/0ee08df0cf4527e40edc9aa28fdety5656bbff2b2/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh | | userrt | 3255 | 0.0 | 0.0 | 11:59 | /bin/bash ./process_monitoring.sh | | userrt | 3286 | 0.0 | 0.0 | 11:59 | /bin/bash ./process_monitoring.sh | +------------+------------+------------+------------+------------+----------------------------+ Desired output on smaller screens, something like this: Enter the name of the process: bash +------------+------------+------------+------------+------------+-----------------------------------+ | USER | PID | %CPU | %MEM | START | COMMAND | +------------+------------+------------+------------+------------+-----------------------------------+ | userrt | 1072 | 0.0 | 0.1 | 09:04 | -bash | | userrt | 1438 | 0.0 | 0.0 | 09:04 | bash | | userrt | 1575 | 0.0 | 0.1 | 09:04 | /bin/bash --init-file /home/ | | | | | | | userrt/.vscode-server/bin/ | | | | | | | 0ee08df0cf4527e40edc9aa28fdety | | | | | | | 5656bbff2b2/out/vs/workbench/ | | | | | | | contrib/terminal/browser/media/ | | | | | | | shellIntegrtion-bash.sh | | userrt | 3255 | 0.0 | 0.0 | 11:59 | /bin/bash ./process_monitoring.sh | | userrt | 3286 | 0.0 | 0.0 | 11:59 | /bin/bash ./process_monitoring.sh | +------------+------------+------------+------------+------------+-----------------------------------+
Avocado (11 rep)
Dec 28, 2023, 12:20 PM • Last activity: Jan 1, 2024, 02:45 AM
1 votes
3 answers
575 views
How to filter a table using awk
I was wondering how to filter a table with several columns based on a specific value in each of the columns of interest. I have this example here: ``` Chr1 16644 0 0 1 1 Chr1 16645 0 0 1 1 Chr1 16646 0 0 1 1 Chr1 16647 0 0 1 1 Chr1 16648 0 0 1 1 Chr1 16649 0 0 1 1 Chr1 16650 0 0 1 1 Chr1 16651 0 0 1...
I was wondering how to filter a table with several columns based on a specific value in each of the columns of interest. I have this example here:
Chr1    16644   0       0       1       1
    Chr1    16645   0       0       1       1
    Chr1    16646   0       0       1       1
    Chr1    16647   0       0       1       1
    Chr1    16648   0       0       1       1
    Chr1    16649   0       0       1       1
    Chr1    16650   0       0       1       1
    Chr1    16651   0       0       1       1
    Chr1    16782   0       0       0       0
    Chr1    16783   0       0       0       0
    Chr1    16784   0       0       0       0
    Chr1    16785   0       0       0       0
    Chr1    16786   0       0       1       1
    Chr1    16787   0       0       1       1
    Chr1    16788   0       0       1       1
    Chr1    16789   0       0       1       1
    Chr1    16790   0       0       1       1
And I would like to remove all the rows containing a zero in all of the columns 3,4,5,6. I have tried it as such
cat STARsamples_read_depth.txt | awk '$3 != 0 && $4 != 0&& $5 != 0 && $6 != 0' | less
But it removes also the rows where only some of these columns have a zero, not in all four! Is there a way to do it? thanks Assa
Assa Yeroslaviz (207 rep)
Oct 18, 2023, 08:31 AM • Last activity: Oct 18, 2023, 03:18 PM
106 votes
16 answers
87964 views
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, the cutting and sorting is easily accomplished via...
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, the cutting and sorting is easily accomplished via the -k option to sort along with cut or awk to view a subset of the columns. However, this method of sorting mixes the column headers in with the rest of the lines of output. Is there an easy way to keep the headers at the top?
jonderry (2109 rep)
Apr 23, 2011, 12:05 AM • Last activity: Jul 7, 2023, 09:26 PM
4 votes
1 answers
1467 views
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 the sheet. That prevents me from sorting the rows...
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 the sheet. That prevents me from sorting the rows and doing the other spreadsheet operations I need to do on the table. How can I get Calc to accept HTML table data structured like shown below and keep the table structure fully intact? Example of a table (partial): Item Super Duper Item
MountainX (18888 rep)
Aug 7, 2014, 05:28 AM • Last activity: Jun 23, 2023, 11:42 PM
0 votes
1 answers
2802 views
Converting data in text file to csv tables
My data in a text file have the below format today ~~~ HKL1234/2, R1B HKL1274/2, R4E HREF457-74, R1A ~~~ I need to present this data in excel file in two different columns like below: ~~~ Product Revision HKL1234/2 R1B HKL1274/2 R4E HREF457-74 R1A ~~~ How can I do this in bash script? would you plea...
My data in a text file have the below format today ~~~ HKL1234/2, R1B HKL1274/2, R4E HREF457-74, R1A ~~~ I need to present this data in excel file in two different columns like below: ~~~ Product Revision HKL1234/2 R1B HKL1274/2 R4E HREF457-74 R1A ~~~ How can I do this in bash script? would you please help me with my challenge.
Dalea Kaldeby (1 rep)
Feb 8, 2023, 09:15 AM • Last activity: Feb 8, 2023, 02:18 PM
0 votes
1 answers
73 views
Do shells have a command equivalent of the "|" pipe symbol? I need something like that in Emacs org-mode tables
I like to construct commands which use the `|` pipe symbol in org tables and `|` symbol messes them up. Do bash et al have a text command that is the equivalent of the symbol? Are there alternative ways of constructing the commands without using the pipe symbol?
I like to construct commands which use the | pipe symbol in org tables and | symbol messes them up. Do bash et al have a text command that is the equivalent of the symbol? Are there alternative ways of constructing the commands without using the pipe symbol?
vfclists (7909 rep)
Feb 7, 2023, 08:08 PM • Last activity: Feb 7, 2023, 10:01 PM
1 votes
4 answers
368 views
How do I use sed to print only a specific "table" in a text report file?
In a report file generated from Quartus, there are multiple "tables" like the following: ``` +---------------------+ ; Section1 Title ; +---------------------+ Miscellaneous text +-----------------+ ; Table1 Header ; +--------+--------; ; Field1 ; Field2 ; ; Field3 ; Field4 ; +--------+--------+ Tab...
In a report file generated from Quartus, there are multiple "tables" like the following:
+---------------------+
; Section1 Title      ;
+---------------------+
Miscellaneous text

+-----------------+
; Table1 Header   ;
+--------+--------;
; Field1 ; Field2 ;
; Field3 ; Field4 ;
+--------+--------+
Table notes

+------------------------+
; Table2 Header          ;
+---------------+--------;
; Longer Field1 ; Field2 ;
; Longer Field3 ; Field4 ;
+---------------+--------+

+---------------------+
; Section2 Title      ;
+---------------------+
Miscellaneous text
NOTE: There is always a blank line between sections and tables. I want to be able to print out just one full table like the following based on it matching the "Table Header".
+-----------------+
; Table1 Header   ;
+--------+--------;
; Field1 ; Field2 ;
; Field3 ; Field4 ;
+--------+--------+
Table notes
We currently use the following combination of a grep to print out the beginning table line and a sed to print the rest, but it seems like I should be able to do it all with just sed.
grep -h -B 1 "; Table1 Header" quartus.rpt | grep -v "; Table1 Header"
sed -n '/; Table1 Header/,/^$/p' quartus.rpt
JohnR (13 rep)
Jan 13, 2023, 09:58 PM • Last activity: Jan 15, 2023, 12:27 PM
1 votes
3 answers
740 views
How to find first occurrence of string in log file, set T/F value as variable, and record changes that occur
I'm not sure how to title this, but here's what I've got: A file with text like: ``` [10:03:43] 10:03:35 22JUN22 ConUP CW1B1 T CW1B3 T CW1B5 T CW1B7 T [10:03:44] CW2B1 T CW2B4 T CW2B5 T CW2B7 T [10:03:44] CW3B1 T CW3B4 T CW3B5 T CW4B4 T [10:03:44] CW4B8 T CW5B4 T CW5B8 T CW6B4 T [10:03:44] CW6B8 T C...
I'm not sure how to title this, but here's what I've got: A file with text like:
[10:03:43] 10:03:35 22JUN22  ConUP     CW1B1 T     CW1B3 T     CW1B5 T     CW1B7 T  
[10:03:44]                          CW2B1 T     CW2B4 T     CW2B5 T     CW2B7 T  
[10:03:44]                          CW3B1 T     CW3B4 T     CW3B5 T     CW4B4 T  
[10:03:44]                          CW4B8 T     CW5B4 T     CW5B8 T     CW6B4 T  
[10:03:44]                          CW6B8 T     CW7B8 T     CW8B4 T     CW8B8 T  
[10:03:44]                          CW9B4 T     CW9B8 T    CW10B4 T    CW10B8 T  
[10:03:44]                         CW11B4 T    CW11B8 T    CW12B4 T    CW12B8 T   
[10:04:16] 10:04:28 22JUN22  ConUP     CW1B1 T     CW1B3 T     CW1B5 T     CW1B7 T  
[10:04:36]                          CW2B1 F     CW2B3 F     CW2B5 F     CW2B7 F  
[10:04:36]                          CW3B1 T     CW3B4 T     CW3B5 T     CW4B4 T  
[10:04:36]                          CW4B8 T     CW5B4 T     CW5B8 T     CW6B4 T  
[10:04:37]                          CW6B8 T     CW7B8 T     CW8B4 T     CW8B8 T  
[10:04:37]                          CW9B4 T     CW9B8 T    CW10B4 T    CW10B8 T  
[10:04:37]                         CW11B4 T    CW11B8 T    CW12B4 T    CW12B8 T
Then the actual file is full of stuff like that with the True and False values changing. Whenever a have an entry of True, and it hasn't changed since the last entry, I wanted to remove that entry, only keeping the entry if the value has changed to False (or from False to True). My thought is I need to find the first occurrence of a string (CW1B1 for example) then store the T or F value that follows it as a variable. Then check for the next occurrence, and compare the T/F value, if it's the same, the use cut or send to remove the entry, and then go look for the next. If it's value has changed, just ignore it and move on. Expected output:
[10:03:43] 10:03:35 22JUN22  ConUP     CW1B1 T     CW1B3 T     CW1B5 T     CW1B7 T  
[10:03:44]                          CW2B1 T     CW2B4 T     CW2B5 T     CW2B7 T  
[10:03:44]                          CW3B1 T     CW3B4 T     CW3B5 T     CW4B4 T  
[10:03:44]                          CW4B8 T     CW5B4 T     CW5B8 T     CW6B4 T  
[10:03:44]                          CW6B8 T     CW7B8 T     CW8B4 T     CW8B8 T  
[10:03:44]                          CW9B4 T     CW9B8 T    CW10B4 T    CW10B8 T  
[10:03:44]                         CW11B4 T    CW11B8 T    CW12B4 T    CW12B8 T   
[10:04:16] 10:04:28 22JUN22  ConUP       
[10:04:36]                          CW2B1 F     CW2B3 F     CW2B5 F     CW2B7 F  
[10:04:36]                          
[10:04:36]                          
[10:04:37]                          
[10:04:37]                          
[10:04:37]
Maybe there is a better way to do it, but I still need help coming up with the framework, then I can go and create all the possible variables required in the script.
ditch (9 rep)
Jun 21, 2022, 06:18 PM • Last activity: Jul 1, 2022, 10:38 AM
0 votes
1 answers
107 views
How to use one table (ods) file as a base for another table file?
I have an accounting ledger table (`.ods`) file which should be the base for other table files. This table file should be the base for other table files such as: * 2023.ods * 2024.ods * 2025.ods These are year files each of which contains a ledger for a given year. --- Of course, each year I could j...
I have an accounting ledger table (.ods) file which should be the base for other table files. This table file should be the base for other table files such as: * 2023.ods * 2024.ods * 2025.ods These are year files each of which contains a ledger for a given year. --- Of course, each year I could just copy-paste the template ledger file and rename the copied file, to, say, 2023.ods but I wonder if it bears any benefits to "export" or "include" the template file into such new files (such as 2023.ods). So, my problem is to determine between mere copy-pasting each new year to exporting/including each new year. I don't seek a primarily opinion based answer but more of a standardization-based prons and cons answer also explaining what to do and how to do it.
searcher (11 rep)
Apr 25, 2022, 03:26 PM • Last activity: Apr 26, 2022, 11:42 PM
-3 votes
3 answers
12904 views
How to transform bash output to bash table
My output after running a program in bash looks like this (two rows, : limiter, four columns of data) ```#003:BMW:11:36``` ```#004:Audi:2:35``` I would like to convert that to a bash table like this | Number | Car | ID | Cost | |:---- |:------| -----| -----| | #003 | BMW | 11 | 36 | #004 | Audi | 2...
My output after running a program in bash looks like this (two rows, : limiter, four columns of data)
#003:BMW:11:36
#004:Audi:2:35
I would like to convert that to a bash table like this | Number | Car | ID | Cost | |:---- |:------| -----| -----| | #003 | BMW | 11 | 36 | #004 | Audi | 2 | 35 Is it possible to use sed/awk for this? My data doesn't come from a file.
Blaine44 (21 rep)
Nov 13, 2021, 12:19 AM • Last activity: Nov 13, 2021, 12:00 PM
0 votes
1 answers
609 views
Sorting a table with a non-newline record separator in bash
I have a table that looks like 'a;b;f|d;e;c|g;h' which I wish to sort by the third column. The output should be 'g;h|d;e;c|a;b;f' If I were to use the standard delimiters `whitespace` and `newline` then this could be accomplished using standard `sort`: printf '%b' 'a b f\nd e c\ng h' | sort -k 3 wou...
I have a table that looks like 'a;b;f|d;e;c|g;h' which I wish to sort by the third column. The output should be 'g;h|d;e;c|a;b;f' If I were to use the standard delimiters whitespace and newline then this could be accomplished using standard sort: printf '%b' 'a b f\nd e c\ng h' | sort -k 3 would output g h d e c a b f The sort command can also take a non standard field separator with the -t option: printf '%b' "a;b;f\nd;e;c\ng;h" | sort -k 3 -t ';' would output g;h d;e;c a;b;f I have however failed to find a way to sort a table with a non-newline record separator. Can this be accomplished? If so, how? Edit ---- A key condition is to alter neither data nor delimiters in the process, only the order in which they appear. Other tools than the sort command are also ok. Preferably POSIX compliant, but not necessarily.
fuumind (449 rep)
Oct 27, 2021, 07:10 AM • Last activity: Oct 27, 2021, 08:14 AM
0 votes
1 answers
44 views
Pasting files and concatating files together
I have various years and months of data for numerous site locations. I have computed the average for all months for each needed year. Each Month/Year has its own its own file. Not all sites have data for a given month so no file exists in that case. What I am attempting to do is take each file Month...
I have various years and months of data for numerous site locations. I have computed the average for all months for each needed year. Each Month/Year has its own its own file. Not all sites have data for a given month so no file exists in that case. What I am attempting to do is take each file Month/Year to build a new file for each site. The file structure I am attempting to build would be |Year | Jan| Feb| |:----|:---|:---| |2002 | xxx| xxx| |2003 | xxx|xxx | |2019 |xxx |xxx | the naming conventions of the files are County071-O3-5001-**2002**.out-**APR**.csv.tmp.ext-avg.dat with the **Bold** text which would change depending on the year and the month. Since there are missing "Months" and Years" data at times I am unsure how to build table to account for missing months of data. Any suggestions how to automate this would be great given I have over 100 sites to do for a 17 year period of time. Thanks
stormctr2 (65 rep)
Jul 13, 2021, 04:54 PM • Last activity: Jul 13, 2021, 06:33 PM
31 votes
2 answers
48804 views
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 U 0 0 0 wlan0 I don't understand how it is analyzed, I mean from top-down or bottom-up? If it is analyzed from top-down the...
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 U 0 0 0 wlan0 I don't understand how it is analyzed, I mean from top-down or bottom-up? If it is analyzed from top-down then everything will always be sent to the router in my home even though the IP destination was 192.168.1.15; but what I knew (wrongly?) was that if a PC is inside my same local network then once I recovered the MAC destination through a broadcast message then my PC could send directly the message to the destination.
zer0uno (1353 rep)
Mar 6, 2015, 10:59 AM • Last activity: Jun 11, 2021, 03:03 PM
1 votes
1 answers
1466 views
Text extraction from HTML page
I am using xidel command to extract text from HTML page. Here is my code xidel http://www.ip-adress.com/ip_tracer/8.8.8.8 --extract " {$field1} ${field2} " I have used template method. When I run this code. I don't get error nor any output at the terminal. This is what I get after executing this cod...
I am using xidel command to extract text from HTML page. Here is my code xidel http://www.ip-adress.com/ip_tracer/8.8.8.8 --extract " {$field1} ${field2} " I have used template method. When I run this code. I don't get error nor any output at the terminal. This is what I get after executing this code **** Retrieving (GET): http://www.ip-adress.com/ip_tracer/8.8.8.8 **** **** Processing: http://www.ip-adress.com/ip_tracer/8.8.8.8 **** ** Current variable state: ** and returns me the $ prompt. I want to know whether the output is stored in any variable?
Swatesh Pakhare (273 rep)
Oct 25, 2015, 04:32 AM • Last activity: Jan 28, 2021, 10:03 PM
4 votes
2 answers
2412 views
BASH: AWK pivot CSV into desired table
I have been struggling with pivoting .csv file into desired table format using bash. My file o/p: ``` $ cat finalcount.csv state,status,count NW,CONGESTED,11 NW,CLEARED,9 ACT,CLEARED,7 ACT,CONGESTED,7 QLD,CLEARED,5 WA,CONGESTED,3 WA,CLEARED,2 VIC,CLEARED,3 VIC,CONGESTED,2 ``` My desired o/p: ``` Sta...
I have been struggling with pivoting .csv file into desired table format using bash. My file o/p:
$ cat finalcount.csv
state,status,count
NW,CONGESTED,11
NW,CLEARED,9
ACT,CLEARED,7
ACT,CONGESTED,7
QLD,CLEARED,5
WA,CONGESTED,3
WA,CLEARED,2
VIC,CLEARED,3
VIC,CONGESTED,2
My desired o/p:
State   Congested  Cleared
ACT     7          7
NW      11         9
VIC     2          3
QLD     -          5
Please share your answer with explanation.
user8421137 (51 rep)
Dec 13, 2019, 09:19 PM • Last activity: Jan 9, 2021, 06:40 PM
0 votes
1 answers
167 views
Transpose large table
guys I am sorry if this has been asked before, but I will give it a try. I have a table (tab delimited text file) that is formatted like this Species1 Species2 Species3 Gene 1 Value Value Value Gene 2 Value Value Value Gene 3 Value Value Value . . . I need to change it to this format instead: Gene 1...
guys I am sorry if this has been asked before, but I will give it a try. I have a table (tab delimited text file) that is formatted like this Species1 Species2 Species3 Gene 1 Value Value Value Gene 2 Value Value Value Gene 3 Value Value Value . . . I need to change it to this format instead: Gene 1 Species 1 Value Gene 2 Species 1 Value Gene 3 Species 1 Value . . . Gene 1 Species 2 Value Gene 2 Species 2 Value Gene 3 Species 2 Value . . . etc. Is there a specific unix command to do this? Or may it be done directly in Excel or something? The table has almost 120 k data points, so I think doing this manually is out of the question. As you can probably tell, I am not exactly an expert in these things. Thanks in advance.
MartinOdegaard (1 rep)
Nov 30, 2020, 03:48 PM • Last activity: Nov 30, 2020, 03:59 PM
0 votes
1 answers
906 views
shell: combining several tables
Within same workdir I have several 2 column tables (with | separators between the columns) containing the same number of lines and share the order within the first column . Here is an example for two tables containing 8 lines: table 1.csv lig10| -5.4600 lig13| -5.9900 lig14| -4.2200 lig15| -4.9200 l...
Within same workdir I have several 2 column tables (with | separators between the columns) containing the same number of lines and share the order within the first column . Here is an example for two tables containing 8 lines: table 1.csv lig10| -5.4600 lig13| -5.9900 lig14| -4.2200 lig15| -4.9200 lig3| -6.9700 lig4| -7.4000 lig5| -6.0000 lig9| -6.5700 table 2.csv lig10| -5.2400 lig13| -6.6900 lig14| -4.4600 lig15| -4.9600 lig3| -6.9000 lig4| -6.3100 lig5| -3.7900 lig9| -6.5800 I would like to merge all tables in that (quite similar) format together side-by-side into big table, taking all data, so that the resulting table should contain the same number of lines with the number of columns proportional to number of fused filles. E.g. for 10 separate tables it would be 20 column table (note: I always take the column number one, even it is the same for all tables!),etc In the resulting table I would like to add header for each 2nd column (of initial table), according to the name of the initial file. Here is expected output for the 2 tables. enter image description here Is it possible to use some linux utility to fuse the tables in terminal in one line command like prog -i /workdir/*.csv -o resulting_table.csv
user3470313 (213 rep)
Oct 9, 2020, 03:06 PM • Last activity: Oct 9, 2020, 03:43 PM
Showing page 1 of 20 total questions