How to print text between specific words(as Inputs arguments) in Shell scripting

后端 未结 1 1448
遥遥无期
遥遥无期 2021-01-27 13:37

I want to print complete text between specific words. Here is my requirement.

\"123.log\" contain below text.

EBSPRODSTART
web logic server
Oracle databa         


        
相关标签:
1条回答
  • 2021-01-27 14:02

    There are three problems with your code:

    1. '...' doesn't interpolate any variables. You need "..." for that.
    2. $DBNAMESTART looks for a variable called DBNAMESTART. You need ${DBNAME}START.
    3. DBANEMEND is not the same as DBNAMEEND.

    Thus:

    sed -n "/^${DBNAME}START\$/,/^${DBNAME}END\$/p"
    
    0 讨论(0)
提交回复
热议问题