<?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 More script help? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/more-script-help/m-p/2629832#M40849</link>
    <description>We have a file in which we would like to parse out lines in which the first character is the letter s.  I have written the script below which works, but I was wondering if there is a better/shorter way to do this.&lt;BR /&gt;&lt;BR /&gt;cat $file |while read line&lt;BR /&gt;do&lt;BR /&gt;fstchar=`echo $line |cut -c1-1`&lt;BR /&gt;if [[ $fstchar = "s" ]];&lt;BR /&gt;then&lt;BR /&gt;echo "$line"&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Also, I noticed that if I didn't enclose the last echo variable in "'s, it would strip all white space.  Why?&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;Greg</description>
    <pubDate>Tue, 11 Dec 2001 22:16:13 GMT</pubDate>
    <dc:creator>Greg Stark_1</dc:creator>
    <dc:date>2001-12-11T22:16:13Z</dc:date>
    <item>
      <title>More script help?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-script-help/m-p/2629832#M40849</link>
      <description>We have a file in which we would like to parse out lines in which the first character is the letter s.  I have written the script below which works, but I was wondering if there is a better/shorter way to do this.&lt;BR /&gt;&lt;BR /&gt;cat $file |while read line&lt;BR /&gt;do&lt;BR /&gt;fstchar=`echo $line |cut -c1-1`&lt;BR /&gt;if [[ $fstchar = "s" ]];&lt;BR /&gt;then&lt;BR /&gt;echo "$line"&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Also, I noticed that if I didn't enclose the last echo variable in "'s, it would strip all white space.  Why?&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;Greg</description>
      <pubDate>Tue, 11 Dec 2001 22:16:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-script-help/m-p/2629832#M40849</guid>
      <dc:creator>Greg Stark_1</dc:creator>
      <dc:date>2001-12-11T22:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: More script help?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-script-help/m-p/2629833#M40850</link>
      <description>grep is ideal for this...&lt;BR /&gt;&lt;BR /&gt;grep "^s" $file &amp;gt;all_lines_with_s&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Tue, 11 Dec 2001 22:19:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-script-help/m-p/2629833#M40850</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2001-12-11T22:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: More script help?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/more-script-help/m-p/2629834#M40851</link>
      <description>Hi Greg,&lt;BR /&gt;&lt;BR /&gt;grep "^s" your_file&lt;BR /&gt;&lt;BR /&gt;If there are no white spaces before the line this will not work. It will be complicated with sed's or the way you are doing.&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Dec 2001 22:24:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/more-script-help/m-p/2629834#M40851</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-12-11T22:24:09Z</dc:date>
    </item>
  </channel>
</rss>

