New answers tagged

2

Here's a shorter answer that uses fold then shifts its output by 11 spaces. To see what it is doing add a -v or -x to the final bash. | sed 's:\(.*\)---\(.*\):printf "%-10s " "\1";fold -w '$(($COLUMNS - 11))' -s <<\\!|sed "1!s/^/ /"\n\2\n!\n:' | bash


3

With gnu awk you can do something simple like this: awk -F '---' ' { gsub(/.{50,60} /,"&\n ",$2) printf "%-10s %s\n", $1, $2 }' For a more accurate long-winded version handling long words: awk -F '---' ' { printf "%-10s ", $1 n = split($2,x," ") len = 11 for(i=1;i<=n;i++){ if(len+length(x[i])>=80){printf "\n "; ...


0

I have just released a program called fienode (← link) which computes a SHA1 hash of the physical extents of a file. Identical CoW copies have the same hash. There is also a more detailed answer here, explaining why this is necessary. How to verify a file copy is reflink/CoW? Note however, that BTRFS is at liberty to change the physical extents. I've ...


2

A few months ago I made a test of the behavior of cp when the target file already exists: $ ls -li total 12 913966 -rw-rw-r-- 1 vagrant vagrant 30 Dec 16 20:26 file1 913965 -rwxrw---- 2 pete vagrant 39 Dec 16 20:35 file2 913965 -rwxrw---- 2 pete vagrant 39 Dec 16 20:35 hardlinktofile2 $ cat file1 This is the contents of file1 $ cat file2 This is the ...



Top 50 recent answers are included