Skip to main content
Post Undeleted by PesaThe
added 32 characters in body
Source Link
PesaThe
  • 633
  • 5
  • 8

UsingAnother straightforward sed:

 sed -n '/cluster_namehost_name/ { n;x; /host_namecluster_name/ { x; p; x }'; x }; h' file

Using sed:

sed -n '/cluster_name/ { n; /host_name/p; }' file

Another straightforward sed:

 sed -n '/host_name/ { x; /cluster_name/ { x; p; x }; x }; h' file
Post Deleted by PesaThe
Source Link
PesaThe
  • 633
  • 5
  • 8

Using sed:

sed -n '/cluster_name/ { n; /host_name/p; }' file