-2

is.at.BigData:It is huge data this is very useful is.in.was.SmallData:It is small data we should not lose the data co.in.let.was.in.rem.MediumData:It is medium data Data is highly confidential

I want the answer as:

BigData
SmallData
MediumData

There are many more lines in the file but I am providing you the sample text.

jmunsch
  • 22,771
  • 11
  • 93
  • 114
  • I want every word in different line – krishnu morla Nov 17 '15 at 05:26
  • You can format your text like this: http://meta.stackexchange.com/questions/22186/how-do-i-format-my-code-blocks You can also edit your own questions if you have things that you would like to add to it by clicking on "edit" See: http://meta.stackexchange.com/questions/21788/how-does-editing-work – jmunsch Nov 17 '15 at 05:57

1 Answers1

0

Your question was not very clear because it wasn't formatted, however:

paragraph='is.at.BigData:It is huge data this is very useful is.in.was.SmallData:It is small data we should not lose the data co.in.let.was.in.rem.MediumData:It is medium data Data is highly confidential'

And then something like:

echo $paragraph | grep -oe 'BigData\|SmallData\|MediumData'

Results in:

BigData
SmallData
MediumData

For every word that you want to search for you could put in a list. And loop over them.

Also see:

How to split one string into multiple strings separated by at least one space in bash shell?

Community
  • 1
  • 1
jmunsch
  • 22,771
  • 11
  • 93
  • 114
  • There were many lines in the file and it was not formatted.Only clue the word starts with (.)dot and contains the 'Data' in the word. – krishnu morla Nov 17 '15 at 06:27