# string search replace

**URL:** <https://community.unix.com/t/string-search-replace/140684>\
**Category:** UNIX for Advanced & Expert Users\
**Created:** [December 18, 2001, 11:10pm UTC](https://community.unix.com/t/string-search-replace/140684 "2001-12-18T23:10:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![krishna](https://community.unix.com/letter_avatar/krishna/32/5_5575768a8748004e209b776fc1b2916d.png) [@krishna](https://community.unix.com/u/krishna)\
**Post date:** [December 18, 2001, 11:10pm UTC](https://community.unix.com/t/string-search-replace/140684/1 "2001-12-18T23:10:46Z")

</div>

Hi all,

can any one help me out to change my data below :

my sample data is like this :

x.txt

'128' '229' 'LOW ' '' '' '179,KG' 'RAB' '' 'PA' '27600' 'M' '6-389' '' 'M' 'ABC' 'M' 'XYZ' '123'  
--

I would like to change 'M' of the with 'Male'  
(I think I have to search 27th occurence of ' and M)

can anyone send me command?

Thanks  
Krishna

---

<div class="post-metadata">

**Author:** ![PxT](https://community.unix.com/user_avatar/community.unix.com/pxt/32/10_2.png) [@PxT](https://community.unix.com/u/PxT)\
**Post date:** [December 19, 2001, 12:49pm UTC](https://community.unix.com/t/string-search-replace/140684/2 "2001-12-19T12:49:44Z")

</div>

If you want to replace every occurence of 'M' with 'Male' just pipe your output to:

sed 's/\'M\'/Male\'/g
