# number sign(#) in sed scripts

**URL:** <https://community.unix.com/t/number-sign-in-sed-scripts/229859>\
**Category:** Shell Programming and Scripting\
**Created:** [February 1, 2009, 7:02am UTC](https://community.unix.com/t/number-sign-in-sed-scripts/229859 "2009-02-01T07:02:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kukuruku](https://community.unix.com/letter_avatar/kukuruku/32/6_22734026db12803ebb3e059622ac3534.png) [@kukuruku](https://community.unix.com/u/kukuruku)\
**Post date:** [February 1, 2009, 7:02am UTC](https://community.unix.com/t/number-sign-in-sed-scripts/229859/1 "2009-02-01T07:02:19Z")

</div>

Hi.

In a simple sed script i have number signs - #. But i can't find any description on their functionality. One thing that i find is that # in sed scripts can mean comment if it is placed in the beginning of the line.  
I thought may be this undocumented(for me) behavior refers to regular expressions - but in regexp # doesn't mean anything special.

Script like that

VAR="1 2"  
echo $VAR|sed 's# # & #'

and we get output

1 & 2

In this simple example i understand how it works. But i want full description to be confident when i change scripts. Any links?

thanks

---

<div class="post-metadata">

**Author:** ![kukuruku](https://community.unix.com/letter_avatar/kukuruku/32/6_22734026db12803ebb3e059622ac3534.png) [@kukuruku](https://community.unix.com/u/kukuruku)\
**Post date:** [February 1, 2009, 7:20am UTC](https://community.unix.com/t/number-sign-in-sed-scripts/229859/2 "2009-02-01T07:20:44Z")

</div>

Wow.  
I found. It is just a delimiter insteed of usual backslash. You can use any delimiter of regexp's in substitute command.  
So the command

sed 's# # & #'

is the same as

sed 's/ / & /'

I should read sed & awk book for some chapters more.  
Topic closed.
