Sample Header Ad - 728x90

Unix & Linux Stack Exchange

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

Latest Questions

0 votes
1 answers
39 views
Can Xfce's Clipman let you cycle the clipboard?
I use [Clipman - xfce4-clipman-plugin][1]. I sometimes copy two items and want to paste them both, one then the other. I would expect to be able to paste one (`ctrl` + `v`), press some keyboard combo to tell clipman to cycle back once, and then I expect to be able to paste (`ctrl` + `v`) again and g...
I use Clipman - xfce4-clipman-plugin . I sometimes copy two items and want to paste them both, one then the other. I would expect to be able to paste one (ctrl + v), press some keyboard combo to tell clipman to cycle back once, and then I expect to be able to paste (ctrl + v) again and get the other item. Does Clipman support this? I am aware of super + v. That is not what I'm asking for. I want to effortlessly paste the previous item. I have not found anything in the documentation to suggest that this is supported.
J. Mini (117 rep)
Jul 23, 2025, 06:37 PM • Last activity: Jul 27, 2025, 06:53 PM
4 votes
2 answers
2017 views
How to use Ctrl+mouse click in tmux?
Due to the change in Tmux2.1, I need to remap my mouse's middle click to tmux's paste: bind -T root MouseDown2Pane run -b "tmux paste-buffer" However, I also would like to enable using Ctrl (or Alt , Cmd ) + middle click to paste the system's clipboard. This is what I have tried (failed) so far: bin...
Due to the change in Tmux2.1, I need to remap my mouse's middle click to tmux's paste: bind -T root MouseDown2Pane run -b "tmux paste-buffer" However, I also would like to enable using Ctrl (or Alt, Cmd) + middle click to paste the system's clipboard. This is what I have tried (failed) so far: bind -T root M+MouseDown2Pane run -b "pbpaste | tmux load-buffer -; tmux paste-buffer"
dragonxlwang (783 rep)
Nov 15, 2015, 07:46 PM • Last activity: Jun 3, 2025, 03:03 AM
4 votes
3 answers
962 views
Fast version of paste
`paste` is a brilliant tool, but it is dead slow: I get around 50 MB/s on my server when running: paste -d, file1 file2 ... file10000 | pv >/dev/null `paste` is using 100% CPU according to `top`, so it is not limited by, say, a slow disk. Looking at the source code it is probably because it uses `ge...
paste is a brilliant tool, but it is dead slow: I get around 50 MB/s on my server when running: paste -d, file1 file2 ... file10000 | pv >/dev/null paste is using 100% CPU according to top, so it is not limited by, say, a slow disk. Looking at the source code it is probably because it uses getc: while (chr != EOF) { sometodo = true; if (chr == line_delim) break; xputchar (chr); chr = getc (fileptr[i]); err = errno; } Is there another tool that does the same, but which is faster? Maybe by reading 4k-64k blocks at a time? Maybe by using vector instructions for finding the newline in parallel instead of looking at a single byte at a time? Maybe using awk or similar? The input files are UTF8 and so big they do not fit in RAM, so reading *everything* into memory is not an option. Edit: thanasisp suggests running jobs in parallel. That improves throughput slightly, but it is still a magnitude slower than pure pv: # Baseline $ pv file* | head -c 10G >/dev/null 10.0GiB 0:00:11 [ 897MiB/s] [> ] 3% # Paste all files at once $ paste -d, file* | pv | head -c 1G >/dev/null 1.00GiB 0:00:21 [48.5MiB/s] [ ] # Paste 11% at a time in parallel, and finally paste these $ paste -d, /dev/null 1.00GiB 0:00:14 [69.2MiB/s] [ ] top still shows that it is the outer paste that is the bottleneck. I tested if increasing the buffer made a difference: $ stdbuf -i8191 -o8191 paste -d, /dev/null 1.00GiB 0:00:12 [80.8MiB/s] [ ] This increased throughput 10%. Increasing the buffer further gave no improvement. This is likely hardware dependent (i.e. it may be due to the size of level 1 CPU cache). Tests are run in a RAM disk to avoid limitations related to the disk subsystem.
Ole Tange (37348 rep)
Nov 23, 2020, 11:46 PM • Last activity: Jan 14, 2025, 02:37 PM
1 votes
2 answers
441 views
vim pastes onto completely wrong location
This has not just once, but happened many times. I'm not sure what I'm doing wrong.. it tends to occur more frequently during remote control. I would set the mouse cursor at a certain position where I would paste, then it either goes to somewhere really far down or somewhere up.. until after meaning...
This has not just once, but happened many times. I'm not sure what I'm doing wrong.. it tends to occur more frequently during remote control. I would set the mouse cursor at a certain position where I would paste, then it either goes to somewhere really far down or somewhere up.. until after meaningless trial/error(of which pattern I do not understand) it will at one point find where I'm looking for. Does anyone know why this is so? As I tried to recreate for capturing of screenshots, it now works fine, again with no logic -_-
dia (133 rep)
Jul 9, 2019, 11:58 AM • Last activity: Oct 28, 2024, 02:20 AM
3 votes
3 answers
3524 views
how can I slow down pasting text into a serial terminal?
I'm working on a raspberry pi, and trying to paste some text files into a command-line text editor `nano`... but the text ends up corrupted on the remote end (partial/incomplete text). I can only guess the paste function of my PC (xubuntu 16.04) is pushing the data too fast (the serial baud is 11520...
I'm working on a raspberry pi, and trying to paste some text files into a command-line text editor nano... but the text ends up corrupted on the remote end (partial/incomplete text). I can only guess the paste function of my PC (xubuntu 16.04) is pushing the data too fast (the serial baud is 115200). Can I slow down the paste function somehow?
nmz787 (210 rep)
Feb 28, 2020, 11:28 AM • Last activity: May 12, 2024, 08:34 AM
-2 votes
4 answers
94 views
How to keep previous and current line if the previous line contains common text?
How to keep previous and current line if the previous line contains common text? I have a main file like this: Hello_world Anna Frank Jeremy Hello_earth Jessie James I would want 3 output files like this: **Output file 1** (Only has the string with the previous hello) Hello_world,Anna Hello_earth,Je...
How to keep previous and current line if the previous line contains common text? I have a main file like this: Hello_world Anna Frank Jeremy Hello_earth Jessie James I would want 3 output files like this: **Output file 1** (Only has the string with the previous hello) Hello_world,Anna Hello_earth,Jessie **Output file 2** (Only has the string WITHOUT previous hello) Frank Jeremy James **Output file 3** (Only has the string with the previous hello and including Hi to string without hello from previous line ) Hello_world,Anna Hello_earth,Jessie Hi,Frank Hi,Jeremy Hi,James I have tried using grep and awk but was not able to get the desired output
jovicue (11 rep)
Feb 8, 2023, 12:07 AM • Last activity: Apr 17, 2024, 06:01 PM
2 votes
0 answers
99 views
The paste command is outputing tabs instead of new lines when used with process substitution
The first command below produces each number on a separate line, and I would expect the second command to do the same thing because the only difference between the two is that we are using `echo '1 2 3'` and `echo {1..3}` (both of which produce the same output). **But, the second command produces th...
The first command below produces each number on a separate line, and I would expect the second command to do the same thing because the only difference between the two is that we are using echo '1 2 3' and echo {1..3} (both of which produce the same output). **But, the second command produces the numbers that are separated by tabs instead of new lines. Why?** Furthermore, notice that the only difference between the second and the third commands is that we are passing the result to paste via process substitution, but without that, it shows the expected result, which could imply that it is a paste related issue, but I don't quite see what the issue is.
§ paste  /dev/null 
1
2
3

§ paste  /dev/null 
1
2
3
--- If it matters, here are the versions of the tools:
§ which tr paste
/usr/local/opt/coreutils/libexec/gnubin/tr
/usr/local/opt/coreutils/libexec/gnubin/paste
§ tr --version
tr (GNU coreutils) 9.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .

Written by Jim Meyering.
§ paste --version
paste (GNU coreutils) 9.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .

Written by David M. Ihnat and David MacKenzie.
§ bash --version
bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)
Copyright (C) 2007 Free Software Foundation, Inc.
§ sw_vers
ProductName:	macOS
ProductVersion:	11.7.10
BuildVersion:	20G1427
I am on macOS, but use GNU utils installed via brew. --- Addition debug information requested by comments with set -x active:
§ paste <(echo {1..3} | tr ' ' '\t' | tr '\t' '\n')
+ paste /dev/fd/63 /dev/fd/62 /dev/fd/61
++ echo 1
++ echo 3
++ tr ' ' '\t'
++ tr ' ' '\t'
++ tr '\t' '\n'
++ tr '\t' '\n'
++ echo 2
++ tr ' ' '\t'
++ tr '\t' '\n'
1	2	3
§ paste <(echo {1..3} | tr ' ' '\n')
+ paste /dev/fd/63 /dev/fd/62 /dev/fd/61
++ echo 1
++ tr ' ' '\n'
++ echo 2
++ echo 3
++ tr ' ' '\n'
++ tr ' ' '\n'
1	2	3
§ echo {1..3} | tr ' ' '\n' | paste
+ tr ' ' '\n'
+ echo 1 2 3
+ paste
1
2
3
And hexdump output:
§ paste <(echo {1..3} | tr ' ' '\n') | hexdump -C
00000000  31 09 32 09 33 0a                                 |1.2.3.|
00000006
§ echo {1..3} | tr ' ' '\n' | paste | hexdump -C
00000000  31 0a 32 0a 33 0a                                 |1.2.3.|
00000006
sudocracy (221 rep)
Nov 3, 2023, 12:27 AM • Last activity: Nov 3, 2023, 10:28 AM
0 votes
5 answers
837 views
How to merge lines in groups of three
I have a file containing the below pattern, up to 2000 lines. For every group of three lines, the pattern repeats with different numerical values, but text values at the beginning are common up to the end of the file. Here I need to merge set of three lines Input like below ABC 1223334 Days 34467854...
I have a file containing the below pattern, up to 2000 lines. For every group of three lines, the pattern repeats with different numerical values, but text values at the beginning are common up to the end of the file. Here I need to merge set of three lines Input like below ABC 1223334 Days 344678544324677 Base 45666 ABC 1234565 Days 234567899765443 Base 456643 Need output looks like ABC 1223334 Days 344678544324677 Base 45666 ABC 1234565 Days 234567899765443 Base 456643
C S Pallapu (41 rep)
Dec 12, 2022, 06:38 PM • Last activity: Oct 10, 2023, 10:43 AM
7 votes
5 answers
710 views
How to make `paste` command stop on shortest file
I have two files: **a.txt** 1 2 3 **b.txt** foo bar baz qux Running `paste a.txt b.txt` gives 1 foo 2 bar 3 baz qux However I want to stop when the shortest file ends (that is, I want to print only complete rows, otherwise a later program down the pipeline will think `qux` is the first field and the...
I have two files: **a.txt** 1 2 3 **b.txt** foo bar baz qux Running paste a.txt b.txt gives 1 foo 2 bar 3 baz qux However I want to stop when the shortest file ends (that is, I want to print only complete rows, otherwise a later program down the pipeline will think qux is the first field and the second is empty, when really it's the only way around). How can I do this?
user1350864 (591 rep)
Jan 6, 2018, 05:13 PM • Last activity: Sep 15, 2023, 08:23 AM
0 votes
2 answers
288 views
Side by side output from two `tail -f` commands
I have two scripts emitting single string to log files periodically that I need to `tail -f` and combine side by side for which I am using `paste`. This works but I am unable to pipe the output to another `tail -f` so that I can get a continuous output of the two strings pasted side by side. To illu...
I have two scripts emitting single string to log files periodically that I need to tail -f and combine side by side for which I am using paste. This works but I am unable to pipe the output to another tail -f so that I can get a continuous output of the two strings pasted side by side. To illustrate / reproduce the problem, I have the following scripts: p1.sh:
#!/bin/bash

i=0
while true
do
  i=$((i+1))
  sleep 4
  echo "P1string$i" >> out1.log
done
p2.sh:
#!/bin/bash

i=0
while true
do
  i=$((i+1))
  sleep 4
  echo "P2string$i" >> out2.log
done
I run them in the background like so:
$ ./p1.sh &
$ ./p2.sh &
Now, this works:
paste <(tail -f out1.log) <(tail -f out2.log)
But this does not work:
paste <(tail -f out1.log) <(tail -f out2.log) | tail -f
In principle, this is just piping stdout to tail -f and should work! no?
Ketan (9426 rep)
Aug 11, 2023, 05:52 PM • Last activity: Aug 12, 2023, 03:22 AM
0 votes
0 answers
983 views
Copying all files and folders of a directory using tar
I am trying to copy my files from ssd to external hdd using linux live boot. The command I'm writing is: `root@ubuntu:/media/ubuntu/4bd92f4b-6b48-4f4a-83ad-9d82d3be488b/home/pegasus# tar cf - Downloads | ( cd /media/ubuntu/Seagate Backup Plus/Downloads; tar xvf -)` But the problems is all directorie...
I am trying to copy my files from ssd to external hdd using linux live boot. The command I'm writing is: root@ubuntu:/media/ubuntu/4bd92f4b-6b48-4f4a-83ad-9d82d3be488b/home/pegasus# tar cf - Downloads | ( cd /media/ubuntu/Seagate Backup Plus/Downloads; tar xvf -) But the problems is all directories aren't getting copied into the hdd. And no files of downloads are getting copied. How can I debug it? How can I use to copy everything from Download directory of my ssd to external hdd using tar? Files that should be copied: Files that should be copied: Files that are getting copied: enter image description here
Zeshan Ahmed Nobin (111 rep)
Apr 12, 2023, 07:39 PM
1 votes
0 answers
144 views
Pasting non-ascii (utf8) into remote urxvt terminal
For pasting text, in urxvt/rxvt-unicode one can use middle button to paste PRIMARY selection. I can do such Mouse-Middle-Click paste in my local urxvt terminal and even a remote server, in Chinese/utf8 strings. EG if I run `date` under `LANG=zh_CN.utf8` environment and I'll get: ``` $ date 2023年 03月...
For pasting text, in urxvt/rxvt-unicode one can use middle button to paste PRIMARY selection. I can do such Mouse-Middle-Click paste in my local urxvt terminal and even a remote server, in Chinese/utf8 strings. EG if I run date under LANG=zh_CN.utf8 environment and I'll get:
$ date
2023年 03月 18日 星期六 15:01:11 EDT
I can then mouse ***select*** the Chinese/utf8 string 星期六 and Mouse-Middle-Click ***paste*** into my urxvt terminal (after my echo), like:
$ echo 星期六
星期六
in my local urxvt terminal and even a remote server. However, if I ssh into my other local machines, or my Oracle cloud then try the same approach, instead of echo 星期六 showing up on my command line, I'm getting: enter image description here if I select the whole echo 星期六, and past into the remote session, then it'll work, for either my local machines or my Oracle cloud server. Here is the screen-cast to illustrate it: enter image description here EG - the Chinese/utf8 strings cannot be pasted into my remote urxvt terminal normally. - however if there are some leading normal ascii characters before the Chinese/utf8 string, then the whole thing can be pasted in normally. All my environment are configured the same across all of them, So I'm thinking there must be something odd with my configuration which works only locally but not remotely. (My local machines and Oracle cloud server displays Chinese/utf8 strings/filenames just fine though.) **UPDATE:** more debug info
$ locale 
LANG=zh_CN.utf8
LANGUAGE=
LC_CTYPE="zh_CN.utf8"
LC_NUMERIC="zh_CN.utf8"
LC_TIME="zh_CN.utf8"
LC_COLLATE="zh_CN.utf8"
LC_MONETARY="zh_CN.utf8"
LC_MESSAGES="zh_CN.utf8"
LC_PAPER="zh_CN.utf8"
LC_NAME="zh_CN.utf8"
LC_ADDRESS="zh_CN.utf8"
LC_TELEPHONE="zh_CN.utf8"
LC_MEASUREMENT="zh_CN.utf8"
LC_IDENTIFICATION="zh_CN.utf8"
LC_ALL=

$ locale charmap
UTF-8

$ grep '^set.*meta' ~/.inputrc
set meta-flag on
set input-meta On
set output-meta On
How to fix it?
xpt (1858 rep)
Mar 24, 2023, 06:08 PM • Last activity: Mar 25, 2023, 07:04 PM
5 votes
3 answers
1075 views
Rounding many values in a csv to 3 decimals (printf ?)
I have a paste command like this `paste -d , file1.csv file2.csv file3.csv` And file2.csv contains numbers like this ``` 0.2 0.3339 0.111111 ``` I want the values in file2.csv having 3 decimals like this: ``` 0.200 0.334 0.111 ``` For one value this is working: `printf "%.3f" "0.3339"` -> `0.334` Bu...
I have a paste command like this paste -d , file1.csv file2.csv file3.csv And file2.csv contains numbers like this
0.2
0.3339
0.111111
I want the values in file2.csv having 3 decimals like this:
0.200
0.334
0.111
For one value this is working: printf "%.3f" "0.3339" -> 0.334 But for multiple values in file2.csv this is not working: paste -d , file1.csv <(printf %s "%.3f" "$(< file2.csv)") file3.csv Maybe there is a good solution?
R 9000 (167 rep)
Feb 24, 2023, 12:21 AM • Last activity: Feb 28, 2023, 11:10 PM
0 votes
3 answers
124 views
Combine .csv-files with different amount of lines
[Here I asked already for a similar problem.](https://unix.stackexchange.com/questions/735118/combine-csv-files-with-text-between-each-line "Combine .csv-files with text between each line") Now I have 3 .csv-files but one of them has only 1 line. **file1.csv** ``` dog cats mouse ``` **file2.csv** ``...
[Here I asked already for a similar problem.](https://unix.stackexchange.com/questions/735118/combine-csv-files-with-text-between-each-line "Combine .csv-files with text between each line") Now I have 3 .csv-files but one of them has only 1 line. **file1.csv**
dog
cats
mouse
**file2.csv**
001a
002a
003c
**file3.csv**
WORD
The output should be
dog,001a,WORD
cats,002a,WORD
mouse,003c,WORD
One solution ([from my previous question](https://unix.stackexchange.com/questions/735118/combine-csv-files-with-text-between-each-line "Combine .csv-files with text between each line")) is: paste -d, file1.csv file2.csv | awk -F, '{print $1 "," $2 ",WORD"}' But "WORD" is here just written and not read from file3.csv. Is there a way to tell paste to fill every line with file3.csv? Or maybe to save file3.csv as a variable and give it to awk?
R 9000 (167 rep)
Feb 12, 2023, 07:33 PM • Last activity: Feb 25, 2023, 06:20 PM
1 votes
1 answers
78 views
Combine .csv-files with text between each line
I have two (or maybe more) files: **file1.csv** ``` dog cats mouse ``` **file2.csv** ``` 001a 002a 003c ``` If I use `paste file1.csv file2.csv` the output is ``` dog 001a cats 002a mouse 003c ``` Of course I can use `paste -d , file1.csv file2.csv` ``` dog,001a cats,002a mouse,003c ``` But I want t...
I have two (or maybe more) files: **file1.csv**
dog
cats
mouse
**file2.csv**
001a
002a
003c
If I use paste file1.csv file2.csv the output is
dog	001a
cats	002a
mouse	003c
Of course I can use paste -d , file1.csv file2.csv
dog,001a
cats,002a
mouse,003c
But I want this **output**
TEXT1-dog-TEXT2-001a-TEXT3
TEXT1-cats-TEXT2-002a-TEXT3
TEXT1-mouse-TEXT2-003c-TEXT3
Is there a way to put multiple .csv files together with extra text before, between and after each line?
R 9000 (167 rep)
Feb 11, 2023, 12:40 AM • Last activity: Feb 11, 2023, 01:54 AM
4 votes
4 answers
3717 views
Combine list of words into one line, then add characters
I want to take a file that has a list of words on each line of its own eg. act bat cat dog eel and put them into one line with comma separated and quoting them. So that it turns out like: 'act', 'bat', 'cat', 'dog', 'eel', so, a single quote, then the word, then another single quote, then a comma, t...
I want to take a file that has a list of words on each line of its own eg. act bat cat dog eel and put them into one line with comma separated and quoting them. So that it turns out like: 'act', 'bat', 'cat', 'dog', 'eel', so, a single quote, then the word, then another single quote, then a comma, then a space. Then output to a new file with a new name.
sh_newbie (43 rep)
Oct 22, 2017, 11:30 AM • Last activity: Jan 16, 2023, 07:14 PM
2 votes
3 answers
52 views
How to collect both full lines, and matching part of line?
Is it possible to output both the `full line` and the `matched parts` of some line? Suppose I have this input ``` low [ 0]: 0xffff0000 Interesting description A hi [ 0]: 0xffff00a0 Interesting description B low [ 1]: 0x5000 Interesting description C hi [ 1]: 0x6000 Interesting description D ... hi [...
Is it possible to output both the full line and the matched parts of some line? Suppose I have this input
low [ 0]: 0xffff0000 Interesting description A
hi  [ 0]: 0xffff00a0 Interesting description B
low [ 1]:     0x5000 Interesting description C
hi  [ 1]:     0x6000 Interesting description D
...
hi  :   0x806000 ...
And I would like to extract the hex value as an interesting part, and then the full line as well. I have used paste and 2 grep commands, but it feels really bulky and I would like to avoid process substitution (<()). This is what I got:
paste -d'\n' <(grep    '0x[0-9a-zA-Z]*' "$file") \
             <(grep -o '0x[0-9a-zA-Z]*' "$file")
What's a more, to-the-point way of doing this? I was thinking about awk, but not sure if it's possible to easily grab the matching part and print that (??? below):
/0x[0-9a-zA-Z]*/ { print $0 ; print ??? }
----- Example output:
low [ 0]: 0xffff0000 Interesting description A
0xffff0000 
hi  [ 0]: 0xffff00a0 Interesting description B
0xffff00a0 
low [ 1]:     0x5000 Interesting description C
0x5000 
hi  [ 1]:     0x6000 Interesting description D
0x6000 
...
hi  :   0x806000 ...
0x806000
Moberg (187 rep)
Dec 14, 2022, 04:33 PM • Last activity: Dec 15, 2022, 12:42 PM
0 votes
2 answers
1879 views
Merge all csv files in directory column wise
Say the directory contained 3 csv files: The first csv: ``` Name, John Age, 18 ``` The second csv: ``` Name, Jim Age, 21 ``` The third csv: ``` Name, Amy Age, 22 ``` I would want the result to be: ``` Name, John, Jim, Amy Age, 18, 21, 22 ``` It's important to know the directory could have n many csv...
Say the directory contained 3 csv files: The first csv:
Name, John
Age, 18
The second csv:
Name, Jim
Age, 21
The third csv:
Name, Amy
Age, 22
I would want the result to be:
Name, John, Jim, Amy
Age, 18, 21, 22
It's important to know the directory could have n many csvs I have both bash and posix shell available Edit: This feels like it should work but still has an issue with regards to order: awk -F, -v OFS="," '{a[FNR]=a[FNR]?a[FNR]FS$2:$1FS$2}END{for(x in a)print x,a[x]}' *.csv > results.csv Which makes no sense as FNR 1 should be first in the array but it is printed last?
Tap (35 rep)
Apr 20, 2022, 05:22 PM • Last activity: Nov 23, 2022, 10:28 AM
3 votes
1 answers
459 views
can't copy screenshot in KDE/Debian 10
I have Debian 10 with KDE. Everything was working fine and suddenly today when I tried to copy a screenshot it didn't work. When I press the printscreen key, I get the popup showing the screenshot with the "copy to clipboard" button like normal, but when I try to paste it into GIMP or another image...
I have Debian 10 with KDE. Everything was working fine and suddenly today when I tried to copy a screenshot it didn't work. When I press the printscreen key, I get the popup showing the screenshot with the "copy to clipboard" button like normal, but when I try to paste it into GIMP or another image program I get: "There is no image data in the clipboard to paste." I tried to "restart" the clipboard by: - right-click on the system tray - uncheck clipboard - click apply (clipboard goes away) - check clipboard - click apply This had no effect. I am able to copy & paste text using ctrl-c/ctrl-v, but the text doesn't show up in the clipboard in the system tray (The images don't show up here either). Is there some other way I can force the clipboard to restart or some way to fix this? **update** I discovered that in konsole if I highlight text and middle-click, it does NOT copy the highlighted text. So the clipboard is really messed up, but I can't figure out any way to reset it.
raphael75 (753 rep)
Nov 3, 2020, 04:57 PM • Last activity: Oct 9, 2022, 09:03 PM
7 votes
4 answers
13812 views
Print two files in two columns side-by-side
I want to output two text files in two columns — one on the left side and other one on the right. `paste` doesn't solve the problem, because it only insert a character as delimiter, so if the first file has lines of different lengths output will be twisted: $ cat file1 looooooooong line line $ cat f...
I want to output two text files in two columns — one on the left side and other one on the right. paste doesn't solve the problem, because it only insert a character as delimiter, so if the first file has lines of different lengths output will be twisted: $ cat file1 looooooooong line line $ cat file2 hello world $ paste file1 file2 looooooooong line hello line world If there was a command to add trailing spaces like fmt --add-spaces --width 50 the problem would be solved(1): $ paste (1) **UPD:** command to add trailing spaces does exist, e. g.
-d '\n' printf '%-50s\n'
. But running `$ paste
belkka (483 rep)
Sep 16, 2017, 06:06 PM • Last activity: Sep 22, 2022, 03:25 PM
Showing page 1 of 20 total questions