<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic issue with x command in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/issue-with-x-command/m-p/435487#M282032</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to delete the footer from the file like below and copy to another file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;BR /&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;BR /&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;BR /&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;/P&gt;&lt;P&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;BR /&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;BR /&gt;Total Recs:6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below linux command is working fine in putty.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;awk 'NR&amp;gt;1 &amp;amp;&amp;amp; /./ { print buf; buf=rs=""} { buf=(buf rs $0); rs=RS } END { if (i=index(buf,RS)) print substr(buf,i+1) }' file1&amp;nbsp;&amp;gt;&amp;nbsp;&lt;SPAN&gt;file2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the below x command is giving error :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x " awk 'NR&amp;gt;1 &amp;amp;&amp;amp; /./ { print buf; buf=rs=""} { buf=(buf rs $0); rs=RS } END { if (i=index(buf,RS)) print substr(buf,i+1) }' file1&amp;nbsp;&amp;gt; file2 &amp;nbsp;2&amp;gt;&amp;amp;1" ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;awk: NR&amp;gt;1 &amp;amp; /./ { print buf; buf=rs="} { buf=(buf rs $0); rs=RS } END { if (i=index(buf,RS)) print substr(buf,i+1) }&lt;BR /&gt;awk: ^ syntax error&lt;BR /&gt;awk: NR&amp;gt;1 &amp;amp; /./ { print buf; buf=rs="} { buf=(buf rs $0); rs=RS } END { if (i=index(buf,RS)) print substr(buf,i+1) }&lt;BR /&gt;awk: ^ unterminated string&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any Ideas on how to resolve this issue?&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2018 23:58:48 GMT</pubDate>
    <dc:creator>sfffdg</dc:creator>
    <dc:date>2018-02-08T23:58:48Z</dc:date>
    <item>
      <title>issue with x command</title>
      <link>https://communities.sas.com/t5/SAS-Programming/issue-with-x-command/m-p/435487#M282032</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to delete the footer from the file like below and copy to another file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;BR /&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;BR /&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;BR /&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;/P&gt;&lt;P&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;BR /&gt;SGW|SGW_CDR_|2017-12-09 174338|2017-12-10 003143|2017-12-09 213311|2017-12-10 013310|39246|0200005649&lt;BR /&gt;Total Recs:6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below linux command is working fine in putty.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;awk 'NR&amp;gt;1 &amp;amp;&amp;amp; /./ { print buf; buf=rs=""} { buf=(buf rs $0); rs=RS } END { if (i=index(buf,RS)) print substr(buf,i+1) }' file1&amp;nbsp;&amp;gt;&amp;nbsp;&lt;SPAN&gt;file2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the below x command is giving error :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x " awk 'NR&amp;gt;1 &amp;amp;&amp;amp; /./ { print buf; buf=rs=""} { buf=(buf rs $0); rs=RS } END { if (i=index(buf,RS)) print substr(buf,i+1) }' file1&amp;nbsp;&amp;gt; file2 &amp;nbsp;2&amp;gt;&amp;amp;1" ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;awk: NR&amp;gt;1 &amp;amp; /./ { print buf; buf=rs="} { buf=(buf rs $0); rs=RS } END { if (i=index(buf,RS)) print substr(buf,i+1) }&lt;BR /&gt;awk: ^ syntax error&lt;BR /&gt;awk: NR&amp;gt;1 &amp;amp; /./ { print buf; buf=rs="} { buf=(buf rs $0); rs=RS } END { if (i=index(buf,RS)) print substr(buf,i+1) }&lt;BR /&gt;awk: ^ unterminated string&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any Ideas on how to resolve this issue?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 23:58:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/issue-with-x-command/m-p/435487#M282032</guid>
      <dc:creator>sfffdg</dc:creator>
      <dc:date>2018-02-08T23:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: issue with x command</title>
      <link>https://communities.sas.com/t5/SAS-Programming/issue-with-x-command/m-p/435501#M282033</link>
      <description>&lt;P&gt;You're encountering an issue because the command you want to run contains both single and double quotes.&amp;nbsp; Yet the X command requires its command to be in quotes.&amp;nbsp; That would require changing the command, unless ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Switch from X to %sysexec.&amp;nbsp; For all practical purposes, it performs the identical function but doesn't require quotes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%sysexec&amp;nbsp;&lt;SPAN&gt;awk 'NR&amp;gt;1 &amp;amp;&amp;amp; /./ { print buf; buf=rs=""} { buf=(buf rs $0); rs=RS } END { if (i=index(buf,RS)) print substr(buf,i+1) }' file1&amp;nbsp;&amp;gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;file2&lt;/SPAN&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 00:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/issue-with-x-command/m-p/435501#M282033</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-09T00:06:01Z</dc:date>
    </item>
  </channel>
</rss>

