<?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: read file data into a variable in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921354#M109583</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;var1=$(cat data_file.dat)&lt;BR /&gt;&lt;BR /&gt;However, if data_file.dat has multiple lines, then your commands have to deal with them.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
    <pubDate>Thu, 06 Mar 2003 19:36:53 GMT</pubDate>
    <dc:creator>Sridhar Bhaskarla</dc:creator>
    <dc:date>2003-03-06T19:36:53Z</dc:date>
    <item>
      <title>read file data into a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921349#M109578</link>
      <description>Hi everyone,&lt;BR /&gt;&lt;BR /&gt;I have a script that needs to read the date from a file and put it into a variable. The file only has one row and one column of data. For example,&lt;BR /&gt;&lt;BR /&gt;&amp;gt; more date_file.dat&lt;BR /&gt;20030331&lt;BR /&gt;&lt;BR /&gt;I'm trying to read date_file.dat and put it into var1. I only need to do this once so I don't need a loop or anything. &lt;BR /&gt;&lt;BR /&gt;Thanks for the help.&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Mar 2003 19:27:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921349#M109578</guid>
      <dc:creator>Kevin Medlin</dc:creator>
      <dc:date>2003-03-06T19:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: read file data into a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921350#M109579</link>
      <description>export var1=`cat date_file.dat`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 06 Mar 2003 19:33:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921350#M109579</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-03-06T19:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: read file data into a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921351#M109580</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;If date_file.dat just have the date info:&lt;BR /&gt;VAR1=`cat date_file.dat`&lt;BR /&gt;&lt;BR /&gt;Rgds.</description>
      <pubDate>Thu, 06 Mar 2003 19:35:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921351#M109580</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2003-03-06T19:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: read file data into a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921352#M109581</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can also do it this way:&lt;BR /&gt;&lt;BR /&gt;VAR1=$(&lt;DATE_FILE.DAT&gt;&lt;/DATE_FILE.DAT&gt;&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Mar 2003 19:35:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921352#M109581</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-03-06T19:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: read file data into a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921353#M109582</link>
      <description>var=$(&lt;DATE_FILE.DAT&gt;&lt;/DATE_FILE.DAT&gt;</description>
      <pubDate>Thu, 06 Mar 2003 19:36:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921353#M109582</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-03-06T19:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: read file data into a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921354#M109583</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;var1=$(cat data_file.dat)&lt;BR /&gt;&lt;BR /&gt;However, if data_file.dat has multiple lines, then your commands have to deal with them.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 06 Mar 2003 19:36:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921354#M109583</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2003-03-06T19:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: read file data into a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921355#M109584</link>
      <description>#!/usr/bin/ksh &lt;BR /&gt;for var1 in `date_file.dat`&lt;BR /&gt;do&lt;BR /&gt;whatever comman you want to do with var1&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Mar 2003 19:37:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921355#M109584</guid>
      <dc:creator>Paul Sperry</dc:creator>
      <dc:date>2003-03-06T19:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: read file data into a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921356#M109585</link>
      <description>Hi Kevin:&lt;BR /&gt;&lt;BR /&gt;Do this:&lt;BR /&gt;&lt;BR /&gt;VAR=`&amp;lt; data_file.dat`&lt;BR /&gt;&lt;BR /&gt;...or:&lt;BR /&gt;&lt;BR /&gt;VAR=$(&amp;lt; data_file.dat)&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 06 Mar 2003 19:39:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921356#M109585</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-03-06T19:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: read file data into a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921357#M109586</link>
      <description>Hi Eevin:&lt;BR /&gt;&lt;BR /&gt;I think you will find the input redirection is faster than spawning 'cat' to read the file and capture the first line into your variable.&lt;BR /&gt;&lt;BR /&gt;In fact, this is documented in the 'sh-posix' man pages:&lt;BR /&gt;&lt;BR /&gt;/begin_quote/&lt;BR /&gt;&lt;BR /&gt;The command substitution $(cat file) can be replaced by the equivalent but faster $(&lt;FILE&gt;&lt;/FILE&gt;&lt;BR /&gt;/end_quote/&lt;BR /&gt;&lt;BR /&gt;...while I am an animal lover, including mmembers of the feline species, I avoid cat's whenever possible! :-;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 06 Mar 2003 21:23:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read-file-data-into-a-variable/m-p/2921357#M109586</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-03-06T21:23:38Z</dc:date>
    </item>
  </channel>
</rss>

