![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with awk script, changing the FS for a single variable | sx3v1l_1n51de | Shell Programming and Scripting | 3 | 11-18-2008 04:59 PM |
| display changing variable in one place on screen in ksh | raidzero | Shell Programming and Scripting | 7 | 09-25-2008 09:24 AM |
| rerun .profile after changing variable | sboxtops | AIX | 2 | 09-02-2008 02:19 PM |
| IFS changing the variable value | pvar | Shell Programming and Scripting | 1 | 02-25-2005 06:21 PM |
| Very simple question about changing PS1 variable at startup! | abidmalik | UNIX for Dummies Questions & Answers | 2 | 08-26-2002 01:05 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Changing a variable Question
I have a variable:
$FILENAME = /XXXX/XXXX/XXXX/file.dat I want to set another variable that will give me this: $FILENAME2=filea.dat So basically i'm chopping up variable $FILENAME. Not sure cut will do this as i'm looking at different directories so the characther length may be different e.g. $FILENAME = /server1/test/data/file.dat or $FILENAME = /server17/dept_area/test/data/file.dat What are the best way's to do this? Last edited by Pablo_beezo; 02-12-2009 at 10:51 AM.. |
|
||||
|
Learn more about it with
Code:
man basename Code:
man dirname Code:
# Make a name for yourself...
typeset -l my_name=${0##*/}
typeset my_path=${0%/*}
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|