The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Windows & DOS: Issues & Discussions
Google UNIX.COM


Windows & DOS: Issues & Discussions Questions involving Unix to Windows (Desktop or Server) go here. Any Windows/DOS questions should go here as well.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unix terminal re-assigned with wrong IP address from window's DHCP tlee SUN Solaris 0 03-10-2008 09:44 PM
converting ksh scripts to sh sherkaner Shell Programming and Scripting 11 09-28-2007 08:39 AM
Converting UNIX scripts to DOS Crozz Windows & DOS: Issues & Discussions 2 11-28-2006 07:33 AM
Converting seeyou SCO 3 01-19-2006 10:22 AM
Converting Text File into XML using Unix Shell Scripts Laud12345 Shell Programming and Scripting 10 02-16-2005 09:35 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-28-2006
Registered User
 

Join Date: Nov 2006
Posts: 5
converting ksh scripts--.bat in window's

hi evry one , I did some ksh scripts for file editing in AIX 5.2 ver,
issue is while I was trying to run these scripts in windows box as batch files windows is not recognising the awk part of the ksh script,as it is GNU environment, so any one who can help me will be appreciated.
this is the sample ksh script and followed by .bat file , plzz let me know whether my syntax is correct or not in the .bat file

#!/bin/ksh
egrep -v "Rpt 038|PM$|Parameters:|Begin |Date: |End |Date:|Plan Beginning
|Page |Fund |Total|Page|^$" $PMSRC/usi38.txt|awk 'BEGIN{ OFS=":"}
{
if( match ( $0 , "Fund:" ) )
{
split($0,arr,":")
cmpny = arr[2]
getline ;
if( ! match($0 , "Code Balance" ) )
{
cmpny = cmpny $0;
getline
}
}
else
print cmpny , $0

}'>$PMSRC/usi38final.txt
___________________________________
.bat file
___________________________________
REM #!/bin/ksh
egrep -v "Rpt 038|PM$|Parameters:|Begin |Date: |End |Date:|Plan Beginning|Page |Fund |Total|Page|^$" D:\temp\usi38.txt| awk "BEGIN { OFS=":"} { if( match( $0,"Fund:")){ split( $0,arr,":")cmpny = arr[2] getline; if( ! match( $0 ,"Code Balance")) { cmpny = cmpny $0; getline}} else print cmpny,$0}" > D:\temp\usi38final.txt
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-28-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,354
I doubt that you have the egrep working either. You can't just shove a ksh script into a bat file and run it on windows. And what do you mean by "windows" anyway? There are more options available on XP pro then there are on XP Home. And Windows 95 would be a real problem. Assuming XP Pro, I see two paths available here:
1. Install a Unix style environment on your "windows" box. Look in our FAQ section for a discussion of all of the options we know about. I use Microsoft SFU on XP Pro and it works pretty well...but it only runs on XP Pro.

2. A complete rewrite in some language more commonly used on Windows. Using a bat file is possible but it is a stretch. I would probably go for VBscript running under WSH.
Reply With Quote
  #3 (permalink)  
Old 11-28-2006
Registered User
 

Join Date: Nov 2006
Posts: 5
but egrep is working fine , yes it is win pro edition.problem is with awk part , I commented awk part and ran only the egrep its working fine when i am trying to run both its not working , when i changed awk to gawk its recognizing but giving me a syntax error at OFS":" , should there be any other syntax while using characters like ':' .
Quote:
Originally Posted by Perderabo
I doubt that you have the egrep working either. You can't just shove a ksh script into a bat file and run it on windows. And what do you mean by "windows" anyway? There are more options available on XP pro then there are on XP Home. And Windows 95 would be a real problem. Assuming XP Pro, I see two paths available here:
1. Install a Unix style environment on your "windows" box. Look in our FAQ section for a discussion of all of the options we know about. I use Microsoft SFU on XP Pro and it works pretty well...but it only runs on XP Pro.

2. A complete rewrite in some language more commonly used on Windows. Using a bat file is possible but it is a stretch. I would probably go for VBscript running under WSH.
Reply With Quote
  #4 (permalink)  
Old 11-28-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,354
If you have egrep and gawk then maybe you have bash too. bash should be able to run the original script.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:51 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0