<?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 Re: Get the last delimited field in shell script ! in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/get-the-last-delimited-field-in-shell-script/m-p/3126716#M152114</link>
    <description>Hi,&lt;BR /&gt;# basename /a/b/c/d/test1.log&lt;BR /&gt;&lt;BR /&gt;or in a script&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;     basename "$line"&lt;BR /&gt;done &amp;lt; ./configfile&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
    <pubDate>Sun, 23 Nov 2003 07:46:37 GMT</pubDate>
    <dc:creator>john korterman</dc:creator>
    <dc:date>2003-11-23T07:46:37Z</dc:date>
    <item>
      <title>Get the last delimited field in shell script !</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/get-the-last-delimited-field-in-shell-script/m-p/3126715#M152113</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I got some difficulties in getting the last delimited field in a shell script.  I have tried "cut", "tr" and "awk"...but it doesn't seem to work.&lt;BR /&gt;&lt;BR /&gt;E.g  I got a file and each line of the file is a full path name of a file.  Since each path will have different levels of subdirectories... It seems I can't simply get the file_name straight away !!&lt;BR /&gt;&lt;BR /&gt;Consider the following content of the configuration file:&lt;BR /&gt;&lt;BR /&gt;/a/b/c/d/test1.log&lt;BR /&gt;/f/g/h/test2.log&lt;BR /&gt;/x/y/test3.log&lt;BR /&gt;&lt;BR /&gt;I would like to get all of the filenames out of the configuration file....therefore:&lt;BR /&gt;&lt;BR /&gt;test1.log&lt;BR /&gt;test2.log&lt;BR /&gt;test3.log&lt;BR /&gt;&lt;BR /&gt;Appreciated for you inputs.&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;&lt;BR /&gt;Chris,&lt;BR /&gt;</description>
      <pubDate>Sun, 23 Nov 2003 07:32:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/get-the-last-delimited-field-in-shell-script/m-p/3126715#M152113</guid>
      <dc:creator>Chris Fung</dc:creator>
      <dc:date>2003-11-23T07:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Get the last delimited field in shell script !</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/get-the-last-delimited-field-in-shell-script/m-p/3126716#M152114</link>
      <description>Hi,&lt;BR /&gt;# basename /a/b/c/d/test1.log&lt;BR /&gt;&lt;BR /&gt;or in a script&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;     basename "$line"&lt;BR /&gt;done &amp;lt; ./configfile&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Sun, 23 Nov 2003 07:46:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/get-the-last-delimited-field-in-shell-script/m-p/3126716#M152114</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-11-23T07:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get the last delimited field in shell script !</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/get-the-last-delimited-field-in-shell-script/m-p/3126717#M152115</link>
      <description>Oh...thanks a lot John !!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Sun, 23 Nov 2003 09:08:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/get-the-last-delimited-field-in-shell-script/m-p/3126717#M152115</guid>
      <dc:creator>Chris Fung</dc:creator>
      <dc:date>2003-11-23T09:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Get the last delimited field in shell script !</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/get-the-last-delimited-field-in-shell-script/m-p/3126718#M152116</link>
      <description>a couple of more ways&lt;BR /&gt;&lt;BR /&gt;awk -F"/" '{print $NF;}' yourfile&lt;BR /&gt;&lt;BR /&gt;sed 's/.*\///' yourfile&lt;BR /&gt;&lt;BR /&gt;while read line&lt;BR /&gt;print ${line##*/}&lt;BR /&gt;done</description>
      <pubDate>Sun, 23 Nov 2003 09:46:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/get-the-last-delimited-field-in-shell-script/m-p/3126718#M152116</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-11-23T09:46:01Z</dc:date>
    </item>
  </channel>
</rss>

