A string variable taking any kind of string has a value "yjava_jboss.log4j_file_appender_pattern_layout='%d .//- %x %-5p [%c] %m%n' " at some point of time during execution. It is to greped on a file that contains with value. I used
grep "$STR" <filename> ,where STR during execution takes value as shown above. But it dint work.. I noticed that the problem is with th [ and ] meta characters
How do we escape characters when we dont even know what character is it and where is it present.???
I need the solution in shell programming.
srujanasadula
0
Newbie Poster
Recommended Answers
Jump to PostHello srujanasadula,
sorry for not providing a whole solution
but here are some ideas:assuming the data to grep is in a file called "data"
you might want to try this one#!/bin/bash # # STR="yjava_jboss.log4j_file_appender_pattern_layout='%d .//- %x %-5p [%c] %m%n' " echo "-->${STR}<--" STR="`echo …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.