# shell scripting and programmming

**URL:** <https://community.unix.com/t/shell-scripting-and-programmming/294754>\
**Category:** Shell Programming and Scripting\
**Created:** [September 5, 2011, 11:23pm UTC](https://community.unix.com/t/shell-scripting-and-programmming/294754 "2011-09-05T23:23:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kullu](https://community.unix.com/letter_avatar/kullu/32/6_22734026db12803ebb3e059622ac3534.png) [@kullu](https://community.unix.com/u/kullu)\
**Post date:** [September 5, 2011, 11:23pm UTC](https://community.unix.com/t/shell-scripting-and-programmming/294754/1 "2011-09-05T23:23:25Z")

</div>

hi ,

i was trying a small script in sed as my main motive is to apppnd a sentence before a line and after a line.

e.g this is the sentence which is present in many files and i want to append 2 more sentences in this sentence of mine.

tanvi is good girl

the result should come out as

here is the introduction  
tanvi is a good girl  
she is very good at speaking

the sentence given above is not independent in some files.....how do i grep this sentence and add and append using sed command as both are editors.

please give your suggestion

---

<div class="post-metadata">

**Author:** ![yazu](https://community.unix.com/user_avatar/community.unix.com/yazu/32/7048_2.png) [@yazu](https://community.unix.com/u/yazu)\
**Post date:** [September 5, 2011, 11:27pm UTC](https://community.unix.com/t/shell-scripting-and-programmming/294754/2 "2011-09-05T23:27:52Z")

</div>

```nohighlight
sed '/tanvi is good girl/{
i\
here is the introduction
a\
she is very good at speaking
}' INPUTFILE

```
