ksh using input file with output going to same file name and location


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ksh using input file with output going to same file name and location
# 1  
Old 05-02-2013
ksh using input file with output going to same file name and location

I've been asked if I can write a "quick" little ksh script that will do the following:

Code:
java java_class_file /dir/input_file.xml /dir/output_file.xml

I'm a complete newbie with ksh so any help would be appreciated.

This is on AIX and java is found in

Code:
/usr/java5/jre/bin/java


Last edited by radoulov; 05-02-2013 at 05:27 PM..
# 2  
Old 05-02-2013
Read our homework rules...
# 3  
Old 05-02-2013
This is actually not a "homework" question
I've mostly done editing of existing scripts to create new ones for DB2. But in this case I have no examples to go by and was just looking for some guidance.

Thanks for your time

Code:
#!bin/ksh
# Java Java class path
#
#
#
# Usage : java java_class /input_xml_file /output_xml_file
#
#
input_file="/appdata/iwayapps1/iway4/bns/my/app_my_out/mx/sc/my_mx_sc_1317600.xml"
output_file=/appdata/iwayapps1/iway4/bns/my/app_my_out/mx/sc/my_mx_sc_1317601.xml"
java_home=/usr/java5/jre/bin/java
java_class=/apps/iwayapps1/iway4/bns/my/dm/app_my_scripts/FixSCFile

$java_home $java_class $input_file $output_file


Last edited by radoulov; 05-02-2013 at 05:27 PM..
# 4  
Old 05-02-2013
The way you are doing it in your posted script is perfect, in case that was the question. Smilie
# 5  
Old 05-04-2013
Quote:
Originally Posted by newbie_ksh
This is actually not a "homework" question
I've mostly done editing of existing scripts to create new ones for DB2. But in this case I have no examples to go by and was just looking for some guidance.

Thanks for your time

Code:
#!bin/ksh
# Java Java class path
#
#
#
# Usage : java java_class /input_xml_file /output_xml_file
#
#
input_file="/appdata/iwayapps1/iway4/bns/my/app_my_out/mx/sc/my_mx_sc_1317600.xml"
output_file=/appdata/iwayapps1/iway4/bns/my/app_my_out/mx/sc/my_mx_sc_1317601.xml"
java_home=/usr/java5/jre/bin/java
java_class=/apps/iwayapps1/iway4/bns/my/dm/app_my_scripts/FixSCFile

$java_home $java_class $input_file $output_file

Without seeing the source files for the class you're trying to run, it is hard to guess at why you would call an xml file an input file or an output file in the command line you're running at the end of the script. But the obvious problem with your script is that you either have an extra double quote (marked in red above) or you are missing a double quote just after the equals sign in that line. With the script shown, the definition for the output_file parameter starts with:
Code:
output_file=

and contains everything after the equals sign to the end of the file and should get a complaint from ksh for a mismatched quote.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh - Read input from file and output CSV i same row

Hello I have the following output and want the output to look: FROM: GigabitEthernet0/0 is up, line protocol is up 1 input errors, 0 CRC, 0 frame, 1 overrun, 0 ignored 275 output errors, 0 collisions, 3 interface resets GigabitEthernet0/1 is up, line protocol is up 0... (4 Replies)
Discussion started by: JayJay2018
4 Replies

2. Shell Programming and Scripting

awk to reformat output if input file is empty, but not if file has data in it

The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format: input chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18 chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)
Discussion started by: cmccabe
3 Replies

3. Shell Programming and Scripting

How to read each line from input file, assign variables, and echo to output file?

I've got a file that looks like this (spaces before first entries intentional): 12345650-000005000GL140227 ANNUAL HELC FEE EN 22345650-000005000GL140227 ANNUAL HELC FEE EN 32345650-000005000GL140227 ANNUAL HELC FEE EN I want to read through the file line by line,... (6 Replies)
Discussion started by: Scottie1954
6 Replies

4. Shell Programming and Scripting

Asking user for input file location using a .sh file in windows system

Hi all, I am creating a .sh file in windows environment using notepad. i need a code which i can write in this .sh file so that it asks me for an input file stored anywhere in my C drive of my windows computer. Please help me out with this. (1 Reply)
Discussion started by: bansalpankaj88
1 Replies

5. Shell Programming and Scripting

shell script to add input at certain location into a file

Hi, I am using Solaris 10 OS and trying to create shell script that can add input at certain location into a file. The input that I am trying to put is new domain name e.g @newdomain.com the file contains, more test01.out user/zzzz786@st.com/INBOX user/zzzz@po.com/INBOX... (8 Replies)
Discussion started by: Mr_47
8 Replies

6. UNIX for Dummies Questions & Answers

12. If an ‘88’ Record with BAI Code ‘902’ was found on input file and not written to Output file, re

This is my input file like this 03,105581,,015,+00000416418,,,901,+00000000148,,,922,+00000000354,,/ 49,+00000000000416920,00002/ 03,5313236,,015,+00231036992,,,045,+00231036992,,,901,+00000048428,,/ 88,100,+0000000000000,0000000,,400,+0000000000000,0000000,/ 88,902,+0000000079077,,/... (0 Replies)
Discussion started by: sgoud
0 Replies

7. Shell Programming and Scripting

AWK Script to convert input file(s) to output file

Hi All, I am hoping someone can help me with some scripting I need to complete using AWK. I'm trying to process multiple fixed files to generate one concatenated fixed file in a standard format. The Input file is:- aaaa bbbbb ccccc 1 xxxx aaa bbb aaaa bbbbb ccccc 2 abcd aaa CCC... (9 Replies)
Discussion started by: jason_v_brown
9 Replies

8. Shell Programming and Scripting

Dynamic output file generation using a input text file with predefined output format

Hi, I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format. Example: File.txt AP|{SSHA}VEEg42CNCghUnGhCVg== APVG3|{SSHA}XK|"password" AP3|{SSHA}XK|"This is test" .... etc --------- test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies

9. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

10. Shell Programming and Scripting

KSH - Sourced file location

The sample scripts below, I am looking for the location of the sourced b.sh file. The b.sh file is source by multiple files, so it is not feasible to rely on a "global" variable or passed argument. Is there any way to determine the location of b.sh within b.sh? a.sh #!/bin/ksh echo "a:... (11 Replies)
Discussion started by: Al262
11 Replies
Login or Register to Ask a Question