Write a program to print all lines that contains a word either “testing” or “qtp”
Answers were Sorted based on User's Feedback
Answer / amit
''' Write a program to print all lines that contains a word either “testing” or “qtp”
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFile = fso.OpenTextFile("C:UsersAmit MoolchandaniDesktop est.txt",1,True)
Do While objFile.AtEndOfStream <> True
str = objFile.ReadLine
If Instr(1,str,"Testing",1) Or Instr(1,str,"qtp",1) Then
Print str
End If
Loop
objFile.Close
Set objFile = Nothing
Set fso = Nothing
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / syamala usha
set fso = createobject("scripting.filesystemobject")
set f=fso.opentextfile("C:
otes HP.txt",1)
Do until f.atendofstream
str=f.readline
a = split(str," ")
flag=0
for j = 0 to ubound(a)
if (a(j) = "testing") or (a(j) = "qtp") then
flag=1
exit for
end if
next
if flag=1 then
msgbox str
end if
loop
f.close
set f= nothing
set fso =nothing
| Is This Answer Correct ? | 0 Yes | 0 No |
How can you create a file object to work with the files in the vbscript language?
write a vb script to display first 5 odd numbers from 1 to 100
What are string functions in vbscript?
What is a class in CSS?
i want to when we will write the scripts either after getting the build or after getting the SRS?
What is the main difference between function and sub-procedure?
How will you get the octal value of the given number in vbscript?
Out of the different type of operators, which are evaluated first and last in the vbscript language?
What is the difference between vb debugger and the script debugger?
How to create pull down menu box using vb script
If a calulator having 3 buttons (of any number)in 3 of them one is not working properly due to which answer is wrong always. write a script to find out which button is not working properly ?
which is the good software training centre in bangalore?