LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-25-2008, 01:14 AM   #1
bharatbsharma
Member
 
Registered: Oct 2007
Posts: 33

Rep: Reputation: 15
Remove a substring and store in variable in shell scripting


Hello

I have a varaiable
tmp=att_abcdef

how do i remove "att_" from this string asn store in asme/other vraibale in shell script so that mu o/p will be

abcdef

Regards
Bharat
 
Old 09-25-2008, 01:26 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,788

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Code:
tmp=${tmp##att_}
 
Old 09-25-2008, 01:28 AM   #3
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
what have you got so far? from previous posts, you should know how to string manipulate by now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell scripting : how to name a variable with the value of another variable JimOrJoe Programming 9 06-15-2008 09:36 PM
Help: removing a variable substring from a string variable in sh script gnparsons Programming 2 06-04-2008 05:21 PM
Bash Shell Scripting Dynamic Variable naming question ZuG Programming 2 02-07-2007 02:39 PM
shell scripting - using ${variable:=","} Steve Riley Linux - General 7 02-08-2005 05:07 AM
shell scripting: variable problem XST1 Programming 7 01-30-2005 01:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration