Create a .sh file for an equivalent Excel VBA code

Hi guys,
I am new to Unix, Need your help here.
I have installed cygwin software (Unix) in my computer (Windows vista). Now i want to create a shell script (.sh file)/other script which is equivalent of VBA code (at the bottom) and then put this .sh file into bin directory of c:/cygwin.
so when i login into cygwin and type some command, it should be able to perform the same function as in VBA code.
Please help me out with this script and its programming.

VBA code:

Sub Macro3()
    sFile = Application.GetOpenFilename("All files (*.*), *.*", 1,  "Select Input File", "Open", False)         'asks for file location
    If TypeName(sFile) = "Boolean" Then             ' if input file "Kget_utran cell" is not provided, exit.
        Exit Sub
    End If
    f = FreeFile
    Open sFile For Input As f
    strfile = Input(LOF(f), #f)     ' read whole file into variable
    Close f    ' no need to keep file open
    Do
      strt = Strings.InStr(strfile, "Bye...")       'Gives start value of this string in the input file.
      If strt = 0 Then Exit Do    ' not found finish
      nd = InStr(strt, strfile, ".log") + 5
      pp = Mid(strfile, (strt - 16), (nd - strt + 16))
      strfile = Replace(strfile, pp, "")
    Loop
    Length = Len(sFile)
    j = 1
    rr = 1
    Do Until rr = 0
        rr = InStr(j, sFile, "\")
        If rr = 0 Then
            GoTo here
        End If
        j = rr + 1
    Loop
here:    y = Left(sFile, j - 2)
    Open y & "\output.txt" For Output As f      'saves at this location
    Print #f, strfile
    Close f
    MsgBox "DONE"
End Sub

provide the input file contents and the expected output format

Hi,
Thanks a lot for replying.
I have attached input & output file in a zip file.

I have a input file (.log/.txt format) which is located in the C:\cygwin\home\ebanpan. so when i login into cygwin software, i need to type some command to perform "deletion of few lines" on this input file and after performing the deletion save the output file at the same location.
the line which need to be deleted is
"
Total: 921 MOs

Bye...
Output has been logged to file /var/opt/ericsson/amos/moshell_logfiles/v46248C/logs_mobatch/2012-01-20/site.mo/15-38/CTL01274.log
"

basically this line is repeated multiple times in the input file which i need to delete. but this line is not fixed, start and end words of this line are fixed. i am also pasting one more line below so you can compare these two lines and find out which words will be fixed and which can change.
"
Total: 926 MOs

Bye...
Output has been logged to file /var/opt/ericsson/amos/moshell_logfiles/v46248C/logs_mobatch/2012-01-20/site.mo/15-38/CTL01270.log
"
I hope you would be able to help me out. If you have any other questions/issues please let me know.
Thanks again.

sed '/^Total/d;/^Bye/d;/^Output has been logged/d' input.txt > output.txt

Hi,
thanks for replying.
I am new to Unix. it would be lot of help, if you can help me out with your reply.
i mean, what do u want me to do with this command.??

should i write this into a notepad and then save this file with .sh extension??

Thanks,

yes

save the below contents into a file and save it as .sh

 
inputfile="$1"
ouputfile="$2"
sed '/^Total/d;/^Bye/d;/^Output has been logged/d' $1 > $2

run the script as

 
./script.sh inputfile.txt ouptut.txt

Hi,
i created .sh file with your code.
but i don't understand about the code
"./script.sh inputfile.txt ouptut.txt"
where should i use this script. sorry to bother you.

i have also attached cygwin snapshot, it may be of any use.

Hi again,
i was able to resolve it. now i understand it.
I have one more query, please help me out on this.
Code:

sed '/^Total/d;/^Bye/d;/^Output has been logged/d' /home/ebanpan/input.txt > /home/ebanpan/output.log

In this code i am fixing the input and output file names (e.g. input.txt and output.txt). instead of this i want user to give names of input & output files (directories may also differ).
please help me out with the code.