<?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: File cp script - questions about grep statement in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958687#M100944</link>
    <description>I will repost.. I am still attempting to figure out why the "empno" variable and destination variables are not clearing with each iteration of the script.</description>
    <pubDate>Thu, 09 Feb 2006 16:51:23 GMT</pubDate>
    <dc:creator>rmueller58</dc:creator>
    <dc:date>2006-02-09T16:51:23Z</dc:date>
    <item>
      <title>File cp script - questions about grep statement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958683#M100940</link>
      <description>All, with the script below I am trying to define a parameter for empno with a FOR statement... the file I am pulling this information out of is a simple unload file from an informix db, &lt;BR /&gt;&lt;BR /&gt;### flat file ###  -- App 2 Hire&lt;BR /&gt;appid     empno  hire date &lt;BR /&gt;123456789|14522|01/31/2006|&lt;BR /&gt;987654321|14503|01/20/2006|&lt;BR /&gt;000111123|14504|01/19/2006|&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# I am looking at the file name within the file system in the first FOR statement to determine the appid, this portion works, however the second FOR statement pulls all values from the $2 field from the flat file, &lt;BR /&gt;&lt;BR /&gt;I want to define it so if a file exists and the associate "appid" has an "empno" then I copy the file.. I believe I am missing something in the second for loop and need a few extra sets of eyes to give an idea of what the heck i'm missing.. Any thought appreciated.. &lt;BR /&gt;&lt;BR /&gt;Rex M&lt;BR /&gt;&lt;BR /&gt;export p1=/upload_resumes/&lt;BR /&gt;export p2=/upload_resumes/backup/&lt;BR /&gt;export wst=/wst-docs/applicant/&lt;BR /&gt;export mps=/mps-docs/mps-docs/applicant/&lt;BR /&gt;export esu=/esu-docs/applicant/&lt;BR /&gt;export plv=/plv-docs/&lt;BR /&gt;&lt;BR /&gt;export wste=/wst-docs/employee/&lt;BR /&gt;export mpse=/mps-docs/mps-docs/employee/&lt;BR /&gt;export esue=/esu-docs/employee/&lt;BR /&gt;export plve=/plv-docs/employee/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;echo NEW&lt;BR /&gt;for fn in `ls /upload_resumes/`&lt;BR /&gt;do&lt;BR /&gt;        for dist in `echo $fn |awk '{print substr($1,1,3)}'`&lt;BR /&gt;        # DISTRICT SPECIFIC INFORMATION&lt;BR /&gt;        do&lt;BR /&gt;                export dist&lt;BR /&gt;&lt;BR /&gt;                case $dist in&lt;BR /&gt;                wst)&lt;BR /&gt;                        export distpath="$wst"&lt;BR /&gt;                        export distpathe="$wste"&lt;BR /&gt;                        ;;&lt;BR /&gt;                mps)&lt;BR /&gt;                        export distpath="$mps"&lt;BR /&gt;                        export distpathe="$mpse"&lt;BR /&gt;                        ;;&lt;BR /&gt;                esu)&lt;BR /&gt;                        export distpath="$esu"&lt;BR /&gt;                        export distpathe="$esue"&lt;BR /&gt;                        ;;&lt;BR /&gt;                plv)&lt;BR /&gt;                        export distpath="$plv"&lt;BR /&gt;                        export distpathe="$plve"&lt;BR /&gt;                        ;;&lt;BR /&gt;                        *)&lt;BR /&gt;                        ;;&lt;BR /&gt;                esac&lt;BR /&gt;&lt;BR /&gt;for appid in `echo $fn |awk -F_ '{print $2}'`&lt;BR /&gt;do&lt;BR /&gt;        echo FILENAME: $fn&lt;BR /&gt;        export appid &lt;BR /&gt;        echo $appid &lt;BR /&gt;        export source="$p1$fn"&lt;BR /&gt;        echo $source&lt;BR /&gt;&lt;BR /&gt;        for empno in `grep -e "$appid" /tmp/"$dist"apphire.txt|awk -F"|" '{print $2}' `&lt;BR /&gt;        do&lt;BR /&gt;                export empno&lt;BR /&gt;                echo $empno &lt;BR /&gt;                echo $appid &lt;BR /&gt;        done&lt;BR /&gt;read&lt;BR /&gt;    if [ -n "$empno" ]&lt;BR /&gt;                  then &lt;BR /&gt;                    export destination="$distpathe$empno/$fn"&lt;BR /&gt;                    echo export destination="$distpathe$empno/$fn"&lt;BR /&gt;&lt;BR /&gt;               if [ -d "$distpathe$empno" ]&lt;BR /&gt;                               then&lt;BR /&gt;                                       cp -f $source $destination&lt;BR /&gt;                               else&lt;BR /&gt;                               mkdir $distpathe$empl_no&lt;BR /&gt;                                       cp -f $source $destination&lt;BR /&gt;                       fi&lt;BR /&gt;&lt;BR /&gt;                  else &lt;BR /&gt;                        echo EMPL_NO has no valued position&lt;BR /&gt;    fi                     &lt;BR /&gt;&lt;BR /&gt;#END OF APPID SPECIFIC INFORMATION&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;#END OF DISTRICT SPECIFIC FILE MANIPULATION&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Feb 2006 16:20:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958683#M100940</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2006-02-09T16:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: File cp script - questions about grep statement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958684#M100941</link>
      <description>HERE is the output i get when run the script.&lt;BR /&gt;&lt;BR /&gt;export destination=/mps-docs/mps-docs/employee/14511/mpsplus_11_1.pdf&lt;BR /&gt;FILENAME: mpsplus_11_2.pdf&lt;BR /&gt;11&lt;BR /&gt;/upload_resumes/mpsplus_11_2.pdf&lt;BR /&gt;14501&lt;BR /&gt;11&lt;BR /&gt;14511&lt;BR /&gt;11&lt;BR /&gt;&lt;BR /&gt;export destination=/mps-docs/mps-docs/employee/14511/mpsplus_11_2.pdf&lt;BR /&gt;FILENAME: mpsplus_1_1.pdf&lt;BR /&gt;1&lt;BR /&gt;/upload_resumes/mpsplus_1_1.pdf&lt;BR /&gt;14522&lt;BR /&gt;1&lt;BR /&gt;14503&lt;BR /&gt;1&lt;BR /&gt;14504&lt;BR /&gt;1&lt;BR /&gt;14383&lt;BR /&gt;1&lt;BR /&gt;14501&lt;BR /&gt;1&lt;BR /&gt;14510&lt;BR /&gt;1&lt;BR /&gt;14502&lt;BR /&gt;1&lt;BR /&gt;14511&lt;BR /&gt;1&lt;BR /&gt;&lt;BR /&gt;export destination=/mps-docs/mps-docs/employee/14511/mpsplus_1_1.pdf&lt;BR /&gt;FILENAME: mpsplus_507745863_2.pdf&lt;BR /&gt;507745863&lt;BR /&gt;/upload_resumes/mpsplus_507745863_2.pdf&lt;BR /&gt;14511&lt;BR /&gt;507745863&lt;BR /&gt;&lt;BR /&gt;export destination=/mps-docs/mps-docs/employee/14511/mpsplus_507745863_2.pdf&lt;BR /&gt;FILENAME: mpsplus_5_1.pdf&lt;BR /&gt;5&lt;BR /&gt;/upload_resumes/mpsplus_5_1.pdf&lt;BR /&gt;14522&lt;BR /&gt;5&lt;BR /&gt;14503&lt;BR /&gt;5&lt;BR /&gt;14504&lt;BR /&gt;5&lt;BR /&gt;14383&lt;BR /&gt;5&lt;BR /&gt;14501&lt;BR /&gt;5&lt;BR /&gt;14510&lt;BR /&gt;5&lt;BR /&gt;14502&lt;BR /&gt;5&lt;BR /&gt;14511&lt;BR /&gt;5&lt;BR /&gt;^[[A&lt;BR /&gt;export destination=/mps-docs/mps-docs/employee/14511/mpsplus_5_1.pdf&lt;BR /&gt;FILENAME: mpsplus_7_1.doc&lt;BR /&gt;7&lt;BR /&gt;/upload_resumes/mpsplus_7_1.doc&lt;BR /&gt;14501&lt;BR /&gt;7&lt;BR /&gt;14502&lt;BR /&gt;7&lt;BR /&gt;14511&lt;BR /&gt;7&lt;BR /&gt;&lt;BR /&gt;export destination=/mps-docs/mps-docs/employee/14511/mpsplus_7_1.doc&lt;BR /&gt;FILENAME: mpsplus_9_1.doc&lt;BR /&gt;9&lt;BR /&gt;/upload_resumes/mpsplus_9_1.doc&lt;BR /&gt;14504&lt;BR /&gt;9&lt;BR /&gt;14501&lt;BR /&gt;9&lt;BR /&gt;14510&lt;BR /&gt;9&lt;BR /&gt;14502&lt;BR /&gt;9&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Feb 2006 16:23:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958684#M100941</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2006-02-09T16:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: File cp script - questions about grep statement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958685#M100942</link>
      <description>found my own answer I think.. &lt;BR /&gt;&lt;BR /&gt;grep -w</description>
      <pubDate>Thu, 09 Feb 2006 16:27:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958685#M100942</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2006-02-09T16:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: File cp script - questions about grep statement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958686#M100943</link>
      <description>the -w elimination one problem but I think my nesting is screwed up still.. &lt;BR /&gt;</description>
      <pubDate>Thu, 09 Feb 2006 16:29:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958686#M100943</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2006-02-09T16:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: File cp script - questions about grep statement</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958687#M100944</link>
      <description>I will repost.. I am still attempting to figure out why the "empno" variable and destination variables are not clearing with each iteration of the script.</description>
      <pubDate>Thu, 09 Feb 2006 16:51:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-cp-script-questions-about-grep-statement/m-p/4958687#M100944</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2006-02-09T16:51:23Z</dc:date>
    </item>
  </channel>
</rss>

