
{"id":18586,"date":"2010-10-06T09:19:06","date_gmt":"2010-10-06T03:49:06","guid":{"rendered":"http:\/\/www.jeffrin.in\/?p=3035"},"modified":"2010-10-06T09:19:06","modified_gmt":"2010-10-06T03:49:06","slug":"build-and-execute-command-lines-from-standard-input-2","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2010\/10\/06\/build-and-execute-command-lines-from-standard-input-2\/","title":{"rendered":"a simple hack related to xargs"},"content":{"rendered":"<pre>\n$ls robinsons.iso\n$ls | grep robinsons.iso | xargs rm\n$ls robinsons.iso\nls: cannot access robinsons.iso: No such file or directory\n$\n\nxargs - build and execute command lines from standard input\nThis  manual  page  documents  the  GNU  version of xargs.  \nxargs reads items from the standard input, delimited by blanks \n(which can be protected with double or single quotes or a backslash)\nor newlines, and executes the command (default is \/bin\/echo) one or \nmore times with any initial-arguments followed by items  read  \nfrom  standard input.  Blank lines on the standard input are \nignored. Because  Unix   filenames  can contain blanks and newlines,\nthis default behaviour is often  problematic; filenames containing \nblanks and\/or newlines are incorrectly processed by xargs. In these\nsituations it is better to use the -0 option, which prevents such\nproblems. When using this option you will need to ensure that the \nprogram which produces the input for xargs also uses a null character\nas a separator.  If that program is GNU find for example, the -print0\noption does this for you.\n\nReference\/Source :\nDebian manual page for \"xargs\".\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>$ls robinsons.iso $ls | grep robinsons.iso | xargs rm $ls robinsons.iso ls: cannot access robinsons.iso: No such file or directory $ xargs &#8211; build and execute command lines from standard input This manual page documents the GNU version of xargs. xargs reads items from the standard input, delimited by blanks (which can be protected with &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2010\/10\/06\/build-and-execute-command-lines-from-standard-input-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;a simple hack related to xargs&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[1716],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/18586"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=18586"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/18586\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=18586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=18586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=18586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}