LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Script queries (https://www.linuxquestions.org/questions/linux-newbie-8/script-queries-4175519378/)

LYC 09-19-2014 04:34 AM

Script queries
 
Hi,

I have a file with content as follows:

aaaaa
bbbbb
ccccc

Is there a way to insert the following pattern in between?

echo " "
echo "#### ####"
echo " "
aaaaa
echo " "
echo "#### ####"
echo " "
bbbbb
echo " "
echo "#### ####"
echo " "
cccc

Thanks in advance.

kaushalpatel1982 09-19-2014 05:42 AM

let say you have 1.txt contains the lines you wrote. Run below command in your script or run it directly from shell

Quote:

cat 1.txt | while read line; do echo "############"; echo $line; done
It's output is as below :

Quote:

############
aaaaa
############
bbbbb
############
ccccc


All times are GMT -5. The time now is 05:21 PM.