I have a variable which contains output from a shell command, I'm trying to 'grep' the variable but it seems that the output is all in one line without linebreaks. So when I 'grep' the variable everything is returned.
For example my variable contains this:
standalone 123 abc greefree ten1 stndalone 334 abc fregree ten1 stndalone 334 abc fregree ten2 stndalone 334 abc fregree ten2 stndalone 334 abc fregree ten1 stndalone 334 abc fregree ten2 stndalone 334 abc fregree ten1 stndalone 334 abc fregree ten1 stndalone 334 abc fregree ten2
I'd like to insert a line break everywhere there is ten1 or ten2. So that when I 'grep' the variable I am only returned a particular line.
Output similar to this
standalone 123 abc greefree ten1
stndalone 334 abc fregree ten1
stndalone 334 abc fregree ten2
stndalone 334 abc fregree ten2
stndalone 334 abc fregree ten1
stndalone 334 abc fregree ten2
stndalone 334 abc fregree ten1
stndalone 334 abc fregree ten1
stndalone 334 abc fregree ten2
Is there a bash command I can use or some type of regex expression?