Print output of grep command in multuple lines

view full story

http://www.unix.com – HI All, I am using grep command to serach a pattern in a list of files and storing the output in a variable. Then i am applying some logic on that variable to get the required output. But Thing is that when the pattern is present mutiple times in a file, i am getting the output of grep in a single row and finally my logic is failing on that output. for example after excuting the command Code: a=`cat LU_SHC_LYLTY_CUST.sql | grep -i "^create temp table"` Output Code: CREATE TEMP TABLE TEMP_SYWR_EMAIL_ID CREATE TEMP TABLE TEMP_JL_SYWR_NO_EMAIL AS CREATE TEMP TABLE TEMP_J (HowTos)