Text filtering from configuration file [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
This question already has an answer here:
Print lines between (and including) two patterns
2 answers
We have a config file which consists of more than 24000 lines.
I am stuck in one task. I need to segregate the lines starting as below (service definition of specific host in icinga2)
Object Service "<host_name>"
And ending with
Files consists multiple other entries as well
I need to filter specific hosts definition alone.
shell-script awk sed grep icinga2
marked as duplicate by Sparhawk, Rui F Ribeiro, Thomas, G-Man, Stephen Harris Dec 3 at 0:40
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
This question already has an answer here:
Print lines between (and including) two patterns
2 answers
We have a config file which consists of more than 24000 lines.
I am stuck in one task. I need to segregate the lines starting as below (service definition of specific host in icinga2)
Object Service "<host_name>"
And ending with
Files consists multiple other entries as well
I need to filter specific hosts definition alone.
shell-script awk sed grep icinga2
marked as duplicate by Sparhawk, Rui F Ribeiro, Thomas, G-Man, Stephen Harris Dec 3 at 0:40
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Checkjq
utility as icinga configs areJSON
files
– Romeo Ninov
Dec 2 at 9:37
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
Print lines between (and including) two patterns
2 answers
We have a config file which consists of more than 24000 lines.
I am stuck in one task. I need to segregate the lines starting as below (service definition of specific host in icinga2)
Object Service "<host_name>"
And ending with
Files consists multiple other entries as well
I need to filter specific hosts definition alone.
shell-script awk sed grep icinga2
This question already has an answer here:
Print lines between (and including) two patterns
2 answers
We have a config file which consists of more than 24000 lines.
I am stuck in one task. I need to segregate the lines starting as below (service definition of specific host in icinga2)
Object Service "<host_name>"
And ending with
Files consists multiple other entries as well
I need to filter specific hosts definition alone.
This question already has an answer here:
Print lines between (and including) two patterns
2 answers
shell-script awk sed grep icinga2
shell-script awk sed grep icinga2
edited Dec 2 at 8:30
Rui F Ribeiro
38.5k1479128
38.5k1479128
asked Dec 2 at 6:16
naren viru
213
213
marked as duplicate by Sparhawk, Rui F Ribeiro, Thomas, G-Man, Stephen Harris Dec 3 at 0:40
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Sparhawk, Rui F Ribeiro, Thomas, G-Man, Stephen Harris Dec 3 at 0:40
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Checkjq
utility as icinga configs areJSON
files
– Romeo Ninov
Dec 2 at 9:37
add a comment |
Checkjq
utility as icinga configs areJSON
files
– Romeo Ninov
Dec 2 at 9:37
Check
jq
utility as icinga configs are JSON
files– Romeo Ninov
Dec 2 at 9:37
Check
jq
utility as icinga configs are JSON
files– Romeo Ninov
Dec 2 at 9:37
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Very simple sed
approach:
sed -n '/incinga2/,/}/p' file
You might be better off with the commented on tools (jq
) if the file's structure becomes more complicated, though.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Very simple sed
approach:
sed -n '/incinga2/,/}/p' file
You might be better off with the commented on tools (jq
) if the file's structure becomes more complicated, though.
add a comment |
up vote
0
down vote
Very simple sed
approach:
sed -n '/incinga2/,/}/p' file
You might be better off with the commented on tools (jq
) if the file's structure becomes more complicated, though.
add a comment |
up vote
0
down vote
up vote
0
down vote
Very simple sed
approach:
sed -n '/incinga2/,/}/p' file
You might be better off with the commented on tools (jq
) if the file's structure becomes more complicated, though.
Very simple sed
approach:
sed -n '/incinga2/,/}/p' file
You might be better off with the commented on tools (jq
) if the file's structure becomes more complicated, though.
answered Dec 2 at 13:18
RudiC
3,7351312
3,7351312
add a comment |
add a comment |
Check
jq
utility as icinga configs areJSON
files– Romeo Ninov
Dec 2 at 9:37