Quote:
Originally Posted by wedtorque
I have a variable that store a string.I am taking a worst case here
Code:
var='this is
my
name'
|
which language is it at all?
Quote:
Originally Posted by wedtorque
how to find whether this variable is present in a file.txt or not
This is my file.txt
Code:
hi all
this
is my
name
but no one likes it
|
I would read that var into a local variable and read that file into another one (keeping spaces, newline, whatever) and now I only need to check if var2 contains var2.
That can be easily solved using perl/python/c/whatever, probably awk too.
Quote:
Originally Posted by wedtorque
but this work only when both var and file.txt have common space and newline format
|
I do not know if you want to preserve those spaces or what to do with them?