I have list of commands where some are having parameters which I need to skip before executing them.
- show abc(h2) xyz
- show abc(h2) xyz opq(h1)
- show abc(h2) xyz <32>
- show abc(a,l) xyz [<32>] opq
- show abc
Ultimately, the list has different combinations of ( ), <>, [] with plain text commands. I want to separate out all other commands from plain commands like "show abc".
Processing needed on commands :-
(h1), (h2), (a,l) are to be discarded
<32> - is to be replaced with any ip address
[<32>] - is to be replaced with any integer digit
I tried following but resultant file was empty :-
cat show-cmd.txt | grep "<|(|[" > hard-cmd.txt
How can I get the result file which has no plain commands using regex?
Desired output file :-
show abc xyz
show abc xyz opq
show abc xyz 1.1.1.1
show abc xyz 2 opq