![]() |
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 |
| Substr in shell script | gjithin | Shell Programming and Scripting | 7 | 05-10-2008 04:40 PM |
| substr() thru awk Korn Shell Script | sbryant | Shell Programming and Scripting | 4 | 01-24-2008 11:16 AM |
| how to assign sql output data to shell script variable | kattics | Shell Programming and Scripting | 1 | 07-07-2006 03:57 PM |
| Trouble using substr function with Bourne shell script | E2004 | Shell Programming and Scripting | 4 | 09-29-2005 10:57 AM |
| return variable from PL/SQL procedure to shell | ap_gore79 | Shell Programming and Scripting | 4 | 06-03-2004 04:49 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to use substr to return data into a shell script variable?
I'm writing a shell script in which I need to be able to pull a portion of the file name out. I'm testing with the following code:
x="O1164885.DAT" y=`ls -ltr *${x}|awk '{print substr($0,3)}'` echo ${x}|awk '{print substr($0,3)}' echo "y="$y I can echo it to the screen just fine but I can't figure out how to store it back into a script variable. Any help would be appreciated. Thanks! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|