martes, 11 de noviembre de 2014

newline in sed or echo on Mac

$ echo hello | sed 's/hello/hello\'$'\nbye/'
hello
bye




$ echo hello | sed 's/hello/hello\'$'\n''bye1\'$'\nbye2/'
hello
bye1
bye2


$ sed -i '' 's/hello/hello\'$'\nbye/g' somefile.txt

martes, 10 de junio de 2014

Fast copy of directories using nc

receiving end (using port 10000):
nc -l 10000 | tar x

sending end:
cd parent_dir
tar cf - *hello* | nc receiving_hostname 10000