Search multiple lines in a file
by cbtshare from LinuxQuestions.org on (#4W7EA)
Hello All,
I have a file with a particular pattern that I want.(with the title ParameterValue)
Code:"ParameterName":
"ParameterValue":
"Description":
"Source": "
"ApplyType":
"DataType":
"AllowedValues":
"IsModifiable":The file also has patterns with no ParameterValue i.e
Code:"ParameterName":
"Description":
"Source": "
"ApplyType":
"DataType":
"AllowedValues":
"IsModifiable":Is there a way I can get only content that corresponding ParameterName AND ParameterValue
The values are in a file calle dbparam2
I have tried the following:
Only gets ParameterValue, but I need the name
Code:grep -- 'ParameterValue*' dbparam2gets both, but it get ParameterName ONLY values as well, they dont match
Code:grep -e ParameterName -e ParameterValue dbparam2Shows nothing
Code:awk '/ParameterName/ && /ParameterValue/' dbparam2Please assist me, thank you


I have a file with a particular pattern that I want.(with the title ParameterValue)
Code:"ParameterName":
"ParameterValue":
"Description":
"Source": "
"ApplyType":
"DataType":
"AllowedValues":
"IsModifiable":The file also has patterns with no ParameterValue i.e
Code:"ParameterName":
"Description":
"Source": "
"ApplyType":
"DataType":
"AllowedValues":
"IsModifiable":Is there a way I can get only content that corresponding ParameterName AND ParameterValue
The values are in a file calle dbparam2
I have tried the following:
Only gets ParameterValue, but I need the name
Code:grep -- 'ParameterValue*' dbparam2gets both, but it get ParameterName ONLY values as well, they dont match
Code:grep -e ParameterName -e ParameterValue dbparam2Shows nothing
Code:awk '/ParameterName/ && /ParameterValue/' dbparam2Please assist me, thank you