Print in New line in loop

Hi ,

i want to print the output in line by line

while read LINE
	 do
	     echo  $LINE | grep UCM | egrep '(Shutdown|Unavailable)' 
	echo  $LINE | grep SRBr | egrep '(Shutdown|Unavailable)' 
	echo  $LINE | grep SRP| egrep '(Shutdown|Unavailable)' 
	echo $LINE | grep OM | grep JMS| egrep '(Running|Online)' 
		  
	 done <output.log

but i m nt getting the output line by line

i tried echo"\n" in between grep stmnts ....not wrkin...pls help...

Their are different version of echo which will work with

\n

and some will not.

Try this

echo "-e"

It would be better to use printf than echo with non-standard options.

But I don't know why you'd need to unless there's a problem with your input file.

What exactly do you get (post the output)?

Please write in English (write not, not nt, working, not wrkin, etc.).
The output should be in multiple lines, unless you're using some other code to display it. Please post the entire code.

By the way, something like this will be more efficient:

awk '/Shutdown|Unavailable/ {
    if (/UCM|SR(Br|P)/) print
  }
/OM/ && /JMS/ && /Running|Online/
  ' output.log 

navsan, if you are working on the same HTML report, I suggest you to put a HTML line break tag to display in newline. Putting a \n will not work for HTML

while read LINE
do
 echo $LINE | grep UCM | egrep '(Shutdown|Unavailable)'; echo "<br>"
 echo $LINE | grep SRBr | egrep '(Shutdown|Unavailable)'; echo "<br>" 
 echo $LINE | grep SRP| egrep '(Shutdown|Unavailable)'; echo "<br>" 
 echo $LINE | grep OM | grep JMS| egrep '(Running|Online)'; echo "<br>" 
done < output.log

I hope this helps.

OM1 JMS JMSRdsfsdfds Rcvr RIA Background Running Manual 3 3 2012-12-10 11:22:58 OM2 JMS JMS RIA  Background Running Manual 3 3 2012-12-10 11:22:47 OM3  JMSRdsfsdfds Rcvr RIA Background Running Manual 3 3 2012-12-10 11:23:05 OM4  JMSRdsfsdfds Rcvr RIA Background Running Manual 3 3 2012-12-10 11:22:51 

i m gettin like this.... i need like this

OM1 JMS JMSRdsfsdfds Rcvr RIA Background Running Manual 3 3 2012-12-10 11:22:58 
OM2 JMS JMS RIA  Background Running Manual 3 3 2012-12-10 11:22:47 
OM3  JMSRdsfsdfds Rcvr RIA Background Running Manual 3 3 2012-12-10 11:23:05 
OM4  JMSRdsfsdfds Rcvr RIA Background Running Manual 3 3 2012-12-10 11:22:51

---------- Post updated at 08:42 PM ---------- Previous update was at 08:36 PM ----------

hi bipinajith,

but its taking long spaces b/w evry line

---------- Post updated at 08:46 PM ---------- Previous update was at 08:42 PM ----------

hi bipinajith,

but its taking long spaces b/w evry line

What does that mean?

You can use sed to put newline before pattern OM.

echo $LINE | grep OM | grep JMS| egrep '(Running|Online)' | sed 's/OM./
&/g'

E.g.

echo "OM1 JMS JMSRdsfsdfds Rcvr RIA Background Running Manual 3 3 2012-12-10 11:22:58 OM2 JMS JMS RIA  Background Running Manual 3 3 2012-12-10 11:22:47" | sed 's/OM./\
&/g'

OM1 JMS JMSRdsfsdfds Rcvr RIA Background Running Manual 3 3 2012-12-10 11:22:58
OM2 JMS JMS RIA  Background Running Manual 3 3 2012-12-10 11:22:47