Sponsored Content
Top Forums Shell Programming and Scripting Looping/Repetition in Batch files Post 92383 by kimpot7268 on Friday 9th of December 2005 03:56:43 PM
Old 12-09-2005
Question Looping/Repetition in Batch files

Hi All,
I'm just new to UNIX, does anyone know how to create a batch file in UNIX that does the following routines:
1.) process multiple files in a directory
in DOS, I set my sample input file as: set INPUTFILE=%1
in UNIX>> ????

2.) every file to be processed by executing a program (maybe a class file in UNIX)
in DOS >> for %%i in (*.txt) do D:\WINDOWS\system32\cmd.exe /v:ON/c C:\RPM\DosBatch\RPM.bat %%i
in UNIX >>????

3.)also has a trapping error wherein I can create a log file
in DOS >> %ERRORLEVEL% > error.log
in UNIX >> ????


FYI, I have attached my sample DOS batch files for reference purposes. If you have sample codes, I appreciate it very much...

Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

looping files

Hi, I have a file a.lst which lists all files. as a.dat b.dat c.dat I want to process these files mentioned in the list file in a loop. Say I want to display only the first line of all the files a.dat , b.dat, c.dat. How can I go about it? Please help. (5 Replies)
Discussion started by: dharmesht
5 Replies

2. Shell Programming and Scripting

Help looping through files, please...

Okay... I've solved one problem. Here's the next. I'm writing a script file that needs to go through a directory and list all files in that directory. I'm using TCL/TK. I figured out how to go through the directory and how to loop through it, but I ran into a little problem. ... (2 Replies)
Discussion started by: kapolani
2 Replies

3. UNIX for Advanced & Expert Users

Looping/Repetition in Batch files

Hi All, I'm just new to UNIX, does anyone know how to create a batch file in UNIX that does the following routines: 1.) process multiple files in a directory in DOS, I set my sample input file as: set INPUTFILE=%1 in UNIX>> ???? 2.) every file to be processed by executing a program... (1 Reply)
Discussion started by: kimpot7268
1 Replies

4. Shell Programming and Scripting

Looping on a list of files...

This isn't working for multiple files. It works for one file though. exists1=$(ls | grep gspp*) for FILES in $exists1 do echo "Loading $exists1" ... (23 Replies)
Discussion started by: lazerfoursix
23 Replies

5. Shell Programming and Scripting

Looping through files...

I posted this in the Solaris forum, but I don't think it's platform specific, so I'm posting it here. Here is the situation. We are a company that has been using a professional publishing system, the software is called "ProType". It runs on Solaris 2.4, however it is no longer supported and we... (6 Replies)
Discussion started by: Fred Goldman
6 Replies

6. Shell Programming and Scripting

Help Looping through files in Vi Script

I am trying to write a script that loops through all the files in the current directory that end in '.slg.gz' and runs a parser on each file. Here is my code: #!/bin/bash FILES_HOME = 'dirname $0' for i in $(ls $FILES_HOME/.slg.gz$);do ./run-feature-parser $(i) > OUTPUT.csv done ... (1 Reply)
Discussion started by: kssteig
1 Replies

7. Shell Programming and Scripting

looping through files

I am writing a ksh which has to load 7 files(.dat files) from input directory into oracle tables using sql loader. The process has to take each file at a time and once if it is loaded succesfully using sql loader into oracle tables then the process has to pick next file and load it into oracle... (2 Replies)
Discussion started by: vpv0002
2 Replies

8. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

9. Shell Programming and Scripting

Need to exclude .NFSxxx files in clear old files batch script

I am new to Shell Scripting and need some help. The following batch job has been failing for me due to the .nfsxxx files in use. I need to know how to modify the following script to exclude the .nfsxxx files so this batch job will not fail on me. I have done lots of googling and keep coming back... (2 Replies)
Discussion started by: kimberlyg2007
2 Replies

10. Shell Programming and Scripting

Looping through Files

Hi all , I am new on this forum . I have to face a particoular implementation issue and I need some help . Requirement : I need to read a particoular file (an xml file) and after reading it I need to call an Oracle Stored Procedure passing the content of the file as paramenter , in order... (3 Replies)
Discussion started by: Kolas79
3 Replies
mwrite(1)						      General Commands Manual							 mwrite(1)

NAME
mwrite - mtools utility to perform a low level write (copy) of a UNIX file to DOS SYNOPSIS
mwrite [-mntv] unixfile msdosfile mwrite [-mntv] unixfile [unixfiles...] [msdosdirectory] OPTIONS
Preserves the file modification time. Specifies that a warning is not issued when an existing file is specified as the target file. If this option is not specified, the mwrite command verifies whether or not to overwrite an existing file. Specifies a text file transfer. Line terminators are converted to the appropriate format. Specifies verbose mode. Displays the new file name if the UNIX file name requires conversion. DESCRIPTION
The mwrite command copies the specified UNIX file to the named DOS file, or copies multiple UNIX files to the named DOS directory. The destination directory cannot be omitted. Reasonable care is taken to create a valid DOS file name. If an invalid name is specified, the mwrite command changes the name, then displays the new name if the -v option is specified. DOS subdirectory names that contain the '/' or '' separator are supported. If you use the '' separator or wildcards, you must enclose file names in quotes to protect them from the shell. The mcd command can be used to establish the device and the current working directory (relative to DOS), otherwise the default is A:. Not all UNIX file names are supported in the DOS world. The mwrite command may have to change UNIX names to fit the DOS file name conven- tions. The following table shows some examples of file name conversions: ----------------------------------------------- UNIX name DOS name Reason for the change ----------------------------------------------- thisisatest THISISAT file name too long file.stuff FILE.STU extension too long prn.txt XRN.TXT PRN is a device name .abc X.ABC null file name hot+cold HOTXCOLD illegal character ----------------------------------------------- EXIT STATUS
The following exit values are returned: Success. Failure. ENVIRONMENT VARIABLES
The following environment variables affect the execution of mwrite: If set, this variable names the file that contains the name of the cur- rent mtools working directory as established by the mcd command. If this variable is not set, the file $HOME/.mcwd is used. FILES
Contains the name of the current mtools working directory as established by the mcd command. If this file does not exist, the default mtools working directory is A:. Executable file SEE ALSO
Commands: dos2unix(1) mcd(1), mcopy(1), mdiskcopy(1), mkmanifest(1), mread(1), mtools(1), unix2dos(1) mwrite(1)
All times are GMT -4. The time now is 02:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy