gamblor01 Posted January 18, 2009 Report Share Posted January 18, 2009 Hi everyone,I have a script that I have written in *nix that works fine. Basically, it searches through a text file and finds expired entries. The only problem is that each entry is on multiple lines. For example:Title: ExpiredUser: John Doeemail: [email protected]----------------------Title: SomethingUser: Jane Doeemail: [email protected]I would like to write a similar .bat file to run in Windows. If we can get it to do the following them I can tweak it further:- Open the input file (let's just call it in.txt)- Search for all lines that contain "Expired"- If an expired entry is found, then echo the username and email that are 2 and 3 lines later.I have a BASH script that does this on *nix machines, and when I tried to copy it to Windows and run it with Cygwin, I couldn't get it to work; it keeps giving me an error stating that the "done" token of my while loop is unexpected (which it shouldn't be). I don't want to have to install Cygwin on a bunch of machines just to get this script to work so I was just trying to copy ONLY the cygwin DLL files that I needed. It finally stopped complaining about missing DLL files but it still doesn't work.Similarly, I could accomplish this task with a Java program, but I don't want to have to install Java on a bunch of a machines either. It seems like a .bat file would be best since it doesn't require any extra installations. Hopefully the above description is clear. Thanks! Quote Link to comment Share on other sites More sharing options...
Hb_Kai Posted January 18, 2009 Report Share Posted January 18, 2009 A conversion table can be found here for MS-DOS to Batch commands. I don't know if it'd be of any help though. Sorry, if not.http://tldp.org/LDP/abs/html/dosbatch.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.