# Shell scripting

**URL:** <https://community.unix.com/t/shell-scripting/368097>\
**Category:** Shell Programming and Scripting\
**Created:** [August 30, 2017, 6:09am UTC](https://community.unix.com/t/shell-scripting/368097 "2017-08-30T06:09:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kvp.mani](https://community.unix.com/letter_avatar/kvp.mani/32/5_5575768a8748004e209b776fc1b2916d.png) [@kvp.mani](https://community.unix.com/u/kvp.mani)\
**Post date:** [August 30, 2017, 6:09am UTC](https://community.unix.com/t/shell-scripting/368097/1 "2017-08-30T06:09:33Z")

</div>

Hi All,

can any one please help me for below.

Need to remove prefix and suffix in filename.

Filename as 123\_filename.xml.123456

need to remove prefix (123) and suffix (123456)

filename should be like filename.xml

please help me to provide program in shell script.

---

<div class="post-metadata">

**Author:** ![RudiC](https://community.unix.com/letter_avatar/rudic/32/5_5575768a8748004e209b776fc1b2916d.png) [@RudiC](https://community.unix.com/u/RudiC)\
**Post date:** [August 30, 2017, 6:26am UTC](https://community.unix.com/t/shell-scripting/368097/2 "2017-08-30T06:26:16Z")

</div>

Welcome to the forum.

Please become accustomed to provide decent context info of your problem.  
It is always helpful to carefully and detailedly phrase a request, and to support it with system info like OS and shell, related environment (variables, options), preferred tools, adequate (representative) sample input and desired output data and the logics connecting the two, and, if existent, system (error) messages verbatim, to avoid ambiguities and keep people from guessing.

Depending on what shell you are using, no script would be needed, but simple shell "parameter expansion" could do the job.

---

<div class="post-metadata">

**Author:** ![joeyg](https://community.unix.com/user_avatar/community.unix.com/joeyg/32/780_2.png) [@joeyg](https://community.unix.com/u/joeyg)\
**Post date:** [August 30, 2017, 8:40am UTC](https://community.unix.com/t/shell-scripting/368097/3 "2017-08-30T08:40:42Z")

</div>

Provide context for the request.  
And, show the work that you have done in attempting to solve the matter.

Please remember, this is not a coding service. This is a support site to help people with problems or when stuck.
