Reloading a File within a shell script

Hi
  Is there a way to reload a file that has just been updated within  shell script. As i want to read the updated content of the file for the rest of the command inside my script

Hello,
I have answered this in your other question.
Regards,
Siddhesh

Similar Messages

  • How to run a spool program in unix environment within a shell script

    Hi
    I have written a spool program , which i run from SQL * PLUS
    using
    @'path of the spool file having extension .sql'
    Now i want to include this spool program within the shell script , please help me , how to do it.
    Thanks in advance ..

    user8703472 wrote:
    Thank You Sir for the reply .
    #!/bin/ksh
    ORACLE_SID=<SID>; export ORACLE_SID
    ORACLE_HOME=<ORACLE_HOME>; export ORACLE_HOME
    $sqlplus / as sysdba <<-EOFSQL1 >> output.log 2>&1
    spool /tmp/a.log
    select * from v\$instance
    spool off;
    EOFSQL1
    Please explain me this statement $sqlplus / as sysdba
    and also what a.log contains .
    i have the user id and password for the DB.
    should i write something like this
    $sqlplus -Uusername -Ppassword -Sservername
    i know how to run a procedure from isql(sybase DB)
    Ahh.... but oracle is not just sybase under a different name.
    It would be a good investment in your career to go to tahiti.oracle.com. Drill down to your product and version. There you will find the complete doc library.
    You should spend a few minutes just getting familiar with what kind of documentation is available there by simply browsing the titles under the "Books" tab.
    Open the Reference Manual and spend a few minutes looking through the table of contents to get familiar with what kind of information is available there. Learning where to look things up in the documentation is time well spent on your career.
    For your immediate task, spend a few minutes looking through the SQLPlus User Guide and Reference.
    Then set yourself a plan to dig deeper.
    - Read a chapter a day from the Concepts Manual.
    - Look in your alert log and find all the non-default initialization parms listed at instance startup. Then read up on each one of them in the Reference Manual. Take a look at your listener.ora, tnsnames.ora, and sqlnet.ora files, then bounce what you see there in the network administrators manual.
    Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime.
    But this project , i need to run the spool program from with in a shell script .We see what you mean, but the term "spool program" has no meaning in Oracle and only serves to cloud the issue. I know you are used to using this term with other products, but "When in Rome ...."
    >
    Thank You in advance ..

  • How to write dbms_out traces into a file (in a shell script)?

    I'm afraid this is a shell scripting question:
    I have the following lines in a script:
    ls $salida/EXAR* | while read FILE
    do
    sqlplus -s user@isntance/password << EOF
    set serveroutput on size 1000000
    set feedback off
    --set trimspool on
    var p_out_result_nv number
    var p_out_DescError_SV varchar2(4000)
    var p_out_Traza_SV varchar2(4000)
    var p_Fich_Entrada varchar2(4000)
    --spool $mi_fich_log
    begin
    :p_Fich_Entrada := replace(('$FILE'),('$salida/'),'');
    dbms_output.put_line('Tratando archivo: '||:p_Fich_Entrada);
    :p_out_result_nv := 0;
    SJPAMIOB.SJPRPRIN('01',:p_Fich_Entrada,:p_Fich_Entrada,'EXSJ_ENTRADA','EXSJ_SALIDA',
    :p_out_result_nv,:p_out_DescError_SV,:p_out_Traza_SV);
    end;
    --spool off
    exit :p_out_result_nv
    EOF
    How can I write all dbms_output.put_line in a file?
    Thanks in advance.

    you can use the package utl_file.
    for this you either
    - need a directory object in the database which points to the folder where your file is located you want to write to:
    CREATE DIRECTORY lutz_dir AS ´/home/oracle/UTL_FILE_DIR´;
    You will need create any directory privilege for this.
    or
    - you must have the init.ora parameter UTL_FILE_DIR set to the location.
    Regards,
    Lutz

  • Starting and stopping an SQL query from within a Shell script

    DB version:10gR2
    OS Version:AIX
    We have a C++ application called WpnCreate.cpp, which is causing some locking problems.
    So, we have decided to capture(using SPOOL) the locking info(session info, blocking program,..etc) using an SQL query.
    WpnCreate.cpp program is initiated by a shell script. So we need this SQL query(.sql) to start firing just before WpnCreate.cpp is called and when WpnCreate.cpp has finished executing, we need the SQL query execution to stop.
    But how do i stop the sql query execution? Should i capture the session id and serial# of this session and use kill -9 at the end of the shell script?
    Flow of the Shell script should be like this
    Step1. Start firing the SQL query which captures the locking info and SPOOL them to a file
    Step2. Execute WpnCreate.cpp program
    Step3. Stop the firing of SQL query once WpnCreate.cpp has finished executing ( i don't know how)How will i go about achieving this?

    How can you run your step 2 untill & unless your step 1 gets over. You can run in background but then it will not capture the correct information.
    I think you need to run your step 1 after step 2 , then only you will be able to capture the information.
    You can run your C++ program in background and can wait for some time using sleep command and then run the query to check the locking information.

  • Using launchctl command within a shell script

    I have successfully installed two daemons, and I would like to be able to disable and enable them via shell scripts, called by the daemons themselves. Here is my first shell script:
    #!/bin/sh
    # Testing for presence of a CODEBOY file
    if [ -e "/Volumes/CODEBOY/Change.txt" ]
    then
    osascript '/Users/praxisii/Library/Scripts/MacScript.scpt'
    launchctl unload -w '/Users/praxisii/Library/LaunchDaemons/WaitDaemon.plist'
    launchctl load -w '/Users/praxisii/Library/LaunchDaemons/RunDaemon.plist'
    fi
    The daemon works just fine, running the background, calling this script, which is waiting for me to plug in my flash drive (entitled CODEBOY). When the flash is plugged in, the applescript is called, and the first launchctl command is executed, which disables the WaitDaemon. As advertised, the .plist file is re-written with the Disabled key set to true. The next line (which is supposed to enable the RunDaemon) is never executed.
    Similarly, if the launchctl line is placed before the osascript line, the applescript is never called. It is as if the shell ignores everything after a single launchctl command, which it will execute.
    Any ideas or comments?

    Gary:
    Thank you for the link to the TN2083. Long, but very informative.
    I appreciate all the other comments on this thread. I am an amateur AppleScript/UNIX scripter, and any opportunity to learn more is much appreciated.
    I have completely re-worked my original launchd agent system for automatic processing of a file on a flash drive. Here is the .plist file that I now use:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>RunOSAscript</string>
    <key>LowPriorityIO</key>
    <true/>
    <key>Program</key>
    <string>/usr/bin/osascript</string>
    <key>ProgramArguments</key>
    <array>
    <string>osascript</string>
    <string>/Users/casdvm/Desktop/AutoFlash.scpt</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>ServiceDescription</key>
    <string>Runs Applescript directly</string>
    <key>StandardOutPath</key>
    <string>/Users/casdvm/Desktop/AutoFlashLog.txt</string>
    <key>StartInterval</key>
    <integer>25</integer>
    </dict>
    </plist>
    The AutoFlash.scpt is an Applescript that simply uses the Finder to check for the presence of a specific file on the flash drive. If it is there, and a certain script property has a value of 2, then it runs the AppleScript that processes the desired file on the flash drive. Once that is done, the script property is set to 0 (to prevent the processing from happening over and over again.). Once the flash drive is removed, the script property is set back to 2 in anticipation of the next time the flash drive is plugged in.
    It is much simpler than the two agents I was messing with beforehand. I did indeed discover that this .plist needs to be saved in the LaunchAgents folder of my user Library (thanks again for pointing that out, Gary).
    The only problem that I have involves the continuous calling of the Applescript from the launchd agent. As you can see from my .plist file, that AppleScript is called every 25 seconds. I tried setting it up using the OnDemand key, but I kept receiving a re-spooling error of some sort (I don't recall exactly; my notes are sketchy on that phase of testing), so I just decided to have it go every 25 seconds. It really doesn't matter, since I can leave the flash drive plugged in all day anyway, and it only processes the desired file once.
    Thanks again for all the commentary and discussion; I am grateful for the assistance.
    Craig Smith

  • How to read specific line in a file through UNIX shell script..

    Dear Friends,
    I have generated .ldt file under admin/import/US folder through FND_LOAD script for Download the responsibility.
    I registred Shell script (Host concurrent program) in Oracle apps. Now i want to read the file in speciific line which i was generated in admin/import/US folder through unix shell script. Please help me how to read specific line and the i want to replace that which i am going to read the specific line.
    Thanks in advance..
    Regards,
    Velu.

    Hi,
    Thanks for reply,
    My requirement i have to find the specific line in a file and find and replace needed word over there it's should happen programatically. i want to read specific line in a file Once complete find and replace the condition should exists. The loop will go to next file and read the same line in next file also do the same process upto how many files over there.i am doing through UNIX shell script. Please help me out to find the
    Your suggestion is highly appriciated.
    Thanks,
    Velu.

  • Rman can not able generate log file in linux shell script

    Friends,
    In shell script we use  below command to save processing information.
    $ORACLE_HOME/bin/rman "target=/" > ${LOG} <<- EOF
    Recent days, it does not work and return message as
    ./test.sh: line 78: LOG: command not found
    ./test.sh: line 83: /u01/test/oracle/scripts/crons/logs/testdb_013120141148.log: No such file or directory
    find: /u01/test/oracle/scripts/crons/logs: No such file or directory
    It seems that rman can not create a log file when we passed log variable value.
    Thanks for help

    Hi,
    Seems some one removed the log directory.. check the log directory as specified in the script. and create that one if not exist.

  • File locking and shell script

    Hi,
    with Mac OS X is there a file locking system to prevent file to be copyied or move to a folder B before they are completely copyied in folder A ?
    Regards

    The files in folder A are created by a program like
    Pitstop
    My question was : what can happen if a file in folder
    A is not complitely created and the shell script
    attempt to copy it ?
    In general, if the shell script attempts to copy a file before the creator is finished writing to it, the shell script will copy the part of the file that's already present, so the copy will be incomplete. The creating application can prevent that (by writing to a temporary file and changing the name of the file only after it's finished writing, or by making the file readable only after it's done), but that's up to the application.

  • Upgraded ROX filer not executing shell scripts

    Hi all,
    I run ICEWM+ROX filer as my lite desktop but after a recent upgrade, ROX does not execute shell scripts on mouse click. It appears that filetype detection has changed so that all scripts are shown with the shellscript icon, whereas before those without a .sh extension where shown with the kde type "cogwheel".
    Any tips much appreciated.
    My thanks in advance!

    I've found a lot of things I don't like about the latest ROX upgrade... too much caching nowadays in my  opinion.

  • Need a sample file for IDQ parameter file and a Shell script to execute it from command line

    Hello,The parameter file itself is generated from cmd line using infacmd command and it automatically creates the parameters inside it based on the parameters created inside the mapping and the workflow. So, even if one provides you a paramtere file for IDQ, it might fail as your workflow definition and its paramters would be different. Thanks,K

    Hi all   My project migrated from Power Center to IDQ developer and I had to move all my mappings to IDQ developer. I was able to migrate everything except for the parameter files. It seems that the layout and syntax for parameter file is different from Power Center. Is there anyone who can help me out or send me a sample of a parameter file for IDQ? As well as a sample shell script to run the mapping or application from the Command line.This is an urgent need and It will be greatly appreciated.   ThanksNaveen Medisetti

  • Concatenate sysdate with file name in shell script

    Hi,
    I have one shell script which i am using to transfer data(SFTP).
    Now I have one requirment to use sysdate along with the file name as the file name for the data being transfered.
    script is like this...
    function connect
    sftp $USER@$HOST <<END_SCRIPT
    lcd $FILE_DIR
    if [ $FILE="PO" ] then
    quote site recfm=fb
    quote site lrecl=230
    pwd
    put $FILE 'OPENPO'
    fi
    quit
    END_SCRIPT
    Can any one tell how i can concatenate sysdate with the file name (put $FILE 'OPENPO')?
    Thanks in Advance,
    RR

    it gets even easier with the 'scp' command.
    please try to use the "code" tags. it is very well possible the forum software did transform parts of your script.
    to get into 'code mode': put { c o d e } on a line (without the spaces), then the code, then { c o d e } again to switch back to normal mode.

  • How to parse a xml file within a WLST script

    Hi all,
    I'm using ALSB2.6 and I'm writing a WLST script that should read config info from a xml file and create an ALSB prj.
    I got an error when I call:
    xmldoc = minidom.parse(sock).documentElement
    The code:
    print '#### IPEventConfigFile: ', IPEventConfigFile
    IPEventConfig = loadXML(IPEventConfigFile)
    where
    def loadXML(source):
    sock = open(source)
    xmldoc = minidom.parse(sock).documentElement
    sock.close()
    return xmldoc
    The error:
    [java] #### IPEventConfigFile: /products/software/terraferma/release3/EventBus/repository/events/DummyEvent/resource/DummyEvent-IPEventConfig.xml
    [java] ===============================================================
    [java] Unexpected error: exceptions.AttributeError
    [java] ===============================================================
    [java] No stack trace available.
    [java] Unexpected error: exceptions.AttributeError
    [java] No stack trace available.
    [java] Problem invoking WLST - Traceback (innermost last):
    [java] File "/products/software/terraferma/release3/EventBus/scripts/cloning.py", line 198, in ?
    [java] File "/products/software/terraferma/release3/EventBus/scripts/cloning.py", line 102, in cloning
    [java] File "/products/software/terraferma/release3/EventBus/scripts/cloning.py", line 178, in loadXML
    [java] File "Lib/xml/dom/minidom.py", line 908, in parse
    [java] File "Lib/xml/dom/minidom.py", line 900, in _doparse
    [java] File "Lib/xml/dom/pulldom.py", line 251, in getEvent
    [java] AttributeError: feed
    Line 178 is:
    xmldoc = minidom.parse(sock).documentElement
    I'm trying to understand where I'm wrong.
    Thanks in advance
    ferp

    Using the SAXParser in JAXP the parsing of the XML file is event driven.
    Instantiate the parser:
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser parser = factory.newSAXParser();
    InputSource is = new InputSource(new FileReader(theXML));call the parse method:
    parser.parse(is, this);The following events are fired as the parser works through the XML public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws org.xml.sax.SAXException
    public void endElement(String namespaceURI, String localName, String qName) throws org.xml.sax.SAXException
    characters(char[] ch, int start, int length)etc.
    You write what you want within each of these sections to handle the structure of your data. Keep in mind SAX is useful only when you know the structure of your XML.

  • Using rsh within shell script unable to run CONCSUB utility.

    I am writing a shell script which will connect to the application server from my DB server.
    I am using RSH for the same and it is working. Now I want to submit Active Users Request using CONCSUB but
    I am not finding correct syntax for the same.
    I am able to execute adstpall.sh using the below combination of commands:
    rsh <server> ". <SCRIPT_LOCATION>/adstpall.sh apps/paswd" > /usr/admin/scripts/my_direc
    Similarly I want to execute CONCSUB but I am not finding the exact syntax for its execution from rsh.
    Thank you very much.

    Hi,
    Thank for the note IDs. But the issue is I am trying to connect to my application server from the DB server using RSH.
    After connecting I am starting the application services using adstrtal.sh and post which I intend to do sanity check
    by submitting Active Users from backend using CONCSUB utility.
    I am getting the below message when trying to do so:
    CONCSUB APPS/****** SYSADMIN "System Administrator" SYSADMIN WAIT=Y CONCURRENT FND FNDSCURS PROGRAM_NAME='"Active Users"'
    ++ CONCSUB APPS/******* SYSADMIN 'System Administrator' SYSADMIN WAIT=Y CONCURRENT FND FNDSCURS 'PROGRAM_NAME="Active Users"'
    /oracle/admin/scripts/U_D/abc123/CONCSUB.sh: line 3: CONCSUB: command not found
    I am able to execute CONCSUB within a shell script on my application server though (just placing the CONCSUB command within a file and executing it).
    CONCSUB APPS/******* SYSADMIN "System Administrator" SYSADMIN WAIT=Y CONCURRENT FND FNDSCURS PROGRAM_NAME='"Active Users"'
    + CONCSUB APPS/******* SYSADMIN 'System Administrator' SYSADMIN WAIT=Y CONCURRENT FND FNDSCURS 'PROGRAM_NAME="Active Users"'
    Submitted request 11897805 for CONCURRENT FND FNDSCURS PROGRAM_NAME="Active Users"
    Normal completion
    ========
    Please guide.
    Thanks,
    Farheen Rasul.

  • Shell scripts to read data from a text file and to load it into a table

    Hi All,
    I have a text file consisting of rows and columns as follows,
    GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
    GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
    GEF001 000093625 MKL005675 000001 000000 000000 000000 000000 000000 000001 My requirement is that, i should read the first 3 columns of this file using a shell script and then i have to insert the data into a table consisting of 3 rows in oracle .
    the whole application is deployed in unix and that text file comes from mainframe. am working in the unix side of the application and i cant access the data directly from the mainframe. so am required to write a script which reads the data from text file which is placed in certain location and i have to load it to oracle database.
    so I can't use SQL * loader.
    Please help me something with this...
    Thanks in advance.

    1. Create a dictionary object in Oracle and assign it to the folder where your file resides
    2. Write a little procedure which opens the file in the newly created directory object using ULT_FILE and inside the FOR LOOP and do INSERTs to table you want
    3. Create a shell script and call that procedure
    You can use the post in my Blog for such issues
    [Using Oracle UTL_FILE, UTL_SMTP packages and Linux Shell Scripting and Cron utility together|http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • FTP log file generation failed in shell script

    Hi ALL,
    I am doing FTP file transfer in shell script and able to FTP the files in to corresponding directory , But when i am trying to check the FTP status through the log files then its giving problem . please check the below code.
    for file in $FILENAME1
    do
    echo "FTP File......$file"
    echo 'FTP the file to AR1 down stream system'
    ret_val=`ftp -n> $file.log <<E
    #ret_val=`ftp -n << !
    open $ar1_server
    user $ar1_uname $ar1_pwd
    hash
    verbose
    cd /var/tmp
    put $file
    bye
    E`
    if [ -f $DATA_OUT/$file.log ]
    then
    grep -i "Transfer complete." $DATA_OUT/$file.log
    if [ $? -eq 0 ]; then
    #mv ${file.log} ${DATA_OUT}/../archive/$file.log.log_`date +"%m%d%y%H%M%S"`
    echo 'Log file archived to archive directory'
    #mv $file ${DATA_OUT}/../archive/$FILENAME1.log_`date +"%m%d%y%H%M%S"`
    echo 'Data file archived to archived directory'
    else
    echo 'FTP process is not successful'
    fi
    else
    echo 'log file generation failed'
    fi
    its giving syntax error end of file not giving the exact line number , please help me on thsi
    Regards
    Deb

    Thanks for ur reply
    Actually i did a mistake in the code i wrote the following piece of code below
    ret_val=`ftp -n> $file.log <<E
    #ret_val=`ftp -n << !
    so after the tilde symbol it as again taking the '# ' as a special character so it was giving error, so i removed the second line now its working fine.

Maybe you are looking for

  • Can you edit the text of a PDF that is placed in inDesign

    I have placed a PDF in inDesign and am curious if I can edit the text of that PDF while in inDesign.

  • Bug in OHW config.xml file

    Hi Team, I am using a master helpset file that refers to multiple <subhelpset>s. This works fine in OracleHelp for Java, but is broken when I display the same files in Oracle Help for the Web. In my owhConfig.xml file, I point to the master helpset f

  • Acroread -landscape option not working for Reader 8.1.3 - Solaris 10

    OK I've read the other posts in which others are having this issue as well. I'm hoping this has been fixed or someone can tell me what we need to do to get this working. This use to work with Solaris 9/Reader 5 but when we upgraded to Solaris 10/Read

  • DME file, is generated with # after every word.

    Dear All~ When I'm generating DME file, I see the file is generated with # after every word. Infact it should generate without #. Do I need to maintain any settings? Please share your experience. Thanks and regards Sri

  • IDOC Inbound processing error

    Hi Experts While IDOC posting i m encountering an error with status 64 (<b>No resources, Immed. processing not possible. Quota for rdispirfc_max_own_used_wp wxceed</b> ) Can anyone explain the reason behind this. Regards DhanyaR Nair