Sponsored Content
Top Forums Shell Programming and Scripting Change the Windows Batch script to UNIX shell script. Post 302348137 by tomailraj on Thursday 27th of August 2009 11:44:38 AM
Old 08-27-2009
Hi KenJackson,
You are almost there in getting my intent.
Purpose of the script:
The purpose of the script is… if the CubeType equals to the second entry of any line of the file CubeList_Europe.txt then the variables Server, CubeType, Application, OTL_Application, Database, OTLUnLockLog should be populated with the rest of entries of the same line.

The CubeList_Europe.txt contains the below information.
; ==================================================================================================== =
; :: File Name : CubeList_Europe.txt
; :: Purpose : This file lists all the Europe Cubes that need to be Outline refreshed.
; :: : The general syntax is 'Server, Cube Type, Application, Application, Cube'
; :: : where the first application is the Outline application, the 2nd app is the
; :: : refreshing app and the cube name applies to both apps.
; :: Creation :
; :: Modifications :
;=================================================================================================== ==

Egfrtsap1,DayGPO,OTLDGPO,Rajx,DayGPO
Egfrtsap1,DayLbl,OTLDLBL,Raj1x,DayLbl


**************************************************************************************

As per your inputs I have changed the script as below:

Script:
;******************************************************************
CubeType=DayGPO
CommonPath=/export/home/essbase/OTL_REFRESH

while IFS=, read a b c d e; do
if [ b = $CubeType ]; then
Server="$a"
CubeType="$b"
Application="$d"
OTL_Application="$c"
Database="$e"
break
fi
done < $CommonPath/CubeList_Europe.txt

OTLUnLockLog=$CommonPath/Logs/$OTL_Application_UnLock_Object.log

echo Server=$Server
echo CubeType=$CubeType
echo Application=$Application
echo OTL_Application=$OTL_Application
echo Database=$Database
echo OTLUnLockLog=$OTLUnLockLog

;***************************************************************

The script is running fine without any errors. But it’s not populating any values to the defined variables except for “$b”.

The current output is as below:
Server=
CubeType=DayGPO
Application=
OTL_Application=
Database=
OTLUnLockLog=/export/home/essbase/OTL_REFRESH/Logs/.log

Except CubeType no other variable got populated.

The Expected Output is:

Server=Egfrtsap1
CubeType=DayGPO
Application=Raj
OTL_Application=OTLDGPO
Database=DayGPO
OTLUnLockLog=/export/home/essbase/OTL_REFRESH/Logs/OTLDGPO_UnLock_Object.log


Please correct this script so that it servers its purpose. Thanks in advance.

Last edited by tomailraj; 08-27-2009 at 01:00 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to convert unix .ksh script to windows .batch script

I am using awk in my .ksh script but when I am trying to run in windows its not recognising awk part of the ksh script , even when I changed it to gawk it does not work, this is how my .ksh and .bat files look like. thanx. #!/bin/ksh egrep -v "Rpt 038|PM$|Parameters:|Begin |Date: |End... (1 Reply)
Discussion started by: 2.5lt V8
1 Replies

2. Shell Programming and Scripting

FTP from unix shell script to windows

Hi, I m trying to connect/establish FTP from unix shell script to my PC.Below the script i have written #!/bin/ksh ftp -v -n ddcappip01.com << "EOF" user Amit jason bye EOF ------------------------------ERROR-------------------------- but i m getting the below error for the... (4 Replies)
Discussion started by: ali560045
4 Replies

3. UNIX for Advanced & Expert Users

Executing a shell script from windows;script present in unix

I need to execute a shell script kept in unix machine from windows. User id, password area available. For eg. There's a shell script wich moves all the logs kept in my home directory to a directory named LOGS. Now i need to get this done through windows; either using a batch file, or java... (4 Replies)
Discussion started by: rajneesh_kapoor
4 Replies

4. Windows & DOS: Issues & Discussions

Gawk Script in Windows batch file - Help

Good morning all. I have been running into a problem running a simple gawk script that selects every third line from an input file and writes it to an output file. gawk "NR%3==0" FileIn > FileOut I am attempting to run this command from a batch file at the command line. I have several hundred... (6 Replies)
Discussion started by: 10000springs
6 Replies

5. Shell Programming and Scripting

FTP from windows to unix server using unix shell script

Hi, Is it possible to ftp a huge zip file from windows to unix server using unix shell scripting? If so what command i need to use. thanks in advance. (1 Reply)
Discussion started by: Shri123
1 Replies

6. Shell Programming and Scripting

Dos batch script to execute unix shell script

Can anyone help me with a dos batch script to execute a shell script residing in an unix server. I am not able to use ssh. Thanks in advance (2 Replies)
Discussion started by: Shri123
2 Replies

7. Shell Programming and Scripting

Windows Batch script for Unix commands

I wish to create a folder on a unix server B from my windows box using windows batch script. Below is my windows batch script. @ ECHO OFF ::Enter your Directory name: echo Enter your Directory name: set /p mydir= plink user1@ServerA mkdir %mydir% At plink command i get logged... (7 Replies)
Discussion started by: mohtashims
7 Replies

8. Shell Programming and Scripting

To run a shell script in remote server from windows batch file

Hi all, i need to run a shell script on remote server. I have created file .bat file in windows server with following code, c:\Users\Desktop\putty.exe -ssh -pw password user@server ./script.sh i need to run the script.sh in my remote server Above command is not working, any... (4 Replies)
Discussion started by: rammm
4 Replies

9. Shell Programming and Scripting

Windows batch script to Shell script

Hi everyone, I've below windows batch script which is used to filter the file contents line by line and assign the matched values to the variables in for loop. for /F "tokens=1,3 delims=:" %%A in (%LOG_DIR%\PM_IS_workflow_status.log) do ( set "ATTR_NAME=%%A" if /i "!ATTR_NAME!" EQU "Folder"... (1 Reply)
Discussion started by: Kathraji
1 Replies

10. Shell Programming and Scripting

Batch script to execute shell script in UNIX server

Hi team, My requirement is to transfer pdf files from windows machine to unix server and then from that unix server we should sftp to another server. I have completed the first part i.e From windows to using to unix server with the help of psftp.exe code: psftp user@host -pw password <... (1 Reply)
Discussion started by: bhupeshchavan
1 Replies
jrunscript(1)						      General Commands Manual						     jrunscript(1)

NAME
jrunscript - command line script shell SYNOPSIS
jrunscript [ options ] [ arguments... ] PARAMETERS
options Options, if used, should follow immediately after the command name. arguments Arguments, if used, should follow immediately after options or command name. DESCRIPTION
jrunscript is a command line script shell. jrunscript supports both an interactive (read-eval-print) mode and a batch (-f option) mode of script execution. This is a scripting language independent shell. By default, JavaScript is the language used, but the -l option can be used to specify a different language. Through Java to scripting language communication, jrunscript supports "exploratory programming" style. NOTE: This tool is experimental and may not be available in future versions of the JDK. OPTIONS
-classpath path Specify where to find the user's .class files that are accessed by the script. -cp path This is a synonym for -classpath path -Dname=value Set a Java system property. -Jflag Pass flag directly to the Java virtual machine on which jrunscript is run. -l language Use the specified scripting language. By default, JavaScript is used. Note that to use other scripting languages, you also need to spec- ify the corresponding script engine's jar file using -cp or -classpath option. -e script Evaluate the given script. This option can be used to run "one liner" scripts specified completely on the command line. -encoding encoding Specify the character encoding used while reading script files. -f script-file Evaluate the given script file (batch mode). -f - Read and evaluate a script from standard input (interactive mode). -help Output help message and exit. -? Output help message and exit. -q List all script engines available and exit. ARGUMENTS
If [arguments...] are present and if no -e or -f option is used, then the first argument is the script file and the rest of the arguments, if any, are passed as script arguments. If [arguments..] and -e or -f option are used, then all [arguments..] are passed as script argu- ments. If [arguments..], -e and -f are missing, interactive mode is used. Script arguments are available to a script in an engine variable named "arguments" of type String array. EXAMPLES
Executing inline scripts jrunscript -e "print('hello world')" jrunscript -e "cat('http://java.sun.com')" Use specified language and evaluate given script file jrunscript -l js -f test.js Interactive mode jrunscript js>print('hello world'); hello world js>34 + 55 89 js> thread(function() { print('hello world'); } hello world js> Run script file with script arguments jrunscript test.js arg1 arg2 arg3 test.js is script file to execute and arg1, arg2 and arg3 are passed to script as script arguments. Script can access these using "argu- ments" array. SEE ALSO
If JavaScript is used, then before evaluating any user defined script, jrunscript initializes certain built-in functions and objects. These JavaScript built-ins are documented in jsdocs. 06 Aug 2006 jrunscript(1)
All times are GMT -4. The time now is 12:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy