Skip to content

Instantly share code, notes, and snippets.

@bojoer
Forked from jakob-stoeck/Copy as textile
Created January 17, 2014 23:09
Show Gist options
  • Save bojoer/8483390 to your computer and use it in GitHub Desktop.
Save bojoer/8483390 to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php
$in = fopen('php://stdin', 'r');
$result=array();
$format='_.';
while($line=fgetcsv($in, 0, "\t")) {
$result[]='|'.$format.implode('|'.$format, $line).'|';
$format='';
}
fclose($in);
$cmd='echo '.escapeshellarg(implode("\n", $result)).' | __CF_USER_TEXT_ENCODING='.posix_getuid().':0x8000100:0x8000100 pbcopy';
shell_exec($cmd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment