![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Windows & DOS: Issues & Discussions Questions involving Unix to Windows (Desktop or Server) go here. Any Windows/DOS questions should go here as well. |
|
|
||||
| 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 10: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 08:33 AM |
| Converting | seeyou | SCO | 3 | 01-19-2006 11:22 AM |
| Converting Text File into XML using Unix Shell Scripts | Laud12345 | Shell Programming and Scripting | 10 | 02-16-2005 10:35 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
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:
|
|
#4
|
||||
|
||||
|
If you have egrep and gawk then maybe you have bash too. bash should be able to run the original script.
|
||||
| Google The UNIX and Linux Forums |