Hot answers tagged

3

I like to use the paste command. paste -d. file1 - - file2 < /dev/null produces desired output file1_a...file2_a file1_b...file2_b file1_c...file2_c file1_d...file2_d - refers to stdin, we use this twice to triple our dots </dev/null is used because we do not want anything between those dots.


2

For the cases where it "works", you are leaving a process running cat which is reading its standard input, which has not been closed. Since that is not (yet) closed, cat continues to run, leaving its standard output open, which is used by the shell (also not closed).


2

Use uploading instead, via SSH from your local machine A "minimal headless *nix" box means you probably SSH into it. So you can also use SSH to upload to it. Which is functionally equivalent to downloading (of software packages etc.) except when you want a download command to include in a script on your headless server of course. As shown in this answer, ...


2

Yep, many ways. I have tested the following two on a file created by: perl -le 'next if $.==1; for(1..20){print join "\t",1..20 }' > file That's a file with 20 lines and 20 tab-separated columns. Perl perl -F'\t' -ale '$"="\t";print "@F[0..7]",@F[8..$#F]' file Note that this joins all the fields from the 10th to the end. If you only want to join ...


2

Assuming a few lines of tably separated values, generated thusly: % perl -E 'say join "\t", 1..8 for 1..3' The various columns can then be dealt with as necessary via the appropriate flags and variables and functions available in Perl. % perl -E 'say join "\t", 1..8 for 1..3' \ | perl -pale '$_=join "\t", @F[0..3], join "", @F[4..7] if $. > 1' 1 2 ...


2

If you don't have any lines longer than 2GB, you can use split --line-bytes=2GB From the info manual: ‘--line-bytes=SIZE’ Put into each output file as many complete lines of INPUT as possible without exceeding SIZE bytes. Individual lines or records longer than SIZE bytes are broken into multiple files.


1

If you paste two files they will be delimited by a tabulator. So just replace the tabulator with your desired separator: $ paste file1 file2 | sed -e 's/\t/.../' If your content has a tabulator then invent a new separator which does not occur like %: $ paste -d% file1 file2 | sed -e s/%/.../



Only top voted, non community-wiki answers of a minimum length are eligible