The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
read a variable character by character, substitute characters with something else vipervenom25 UNIX for Dummies Questions & Answers 2 06-06-2008 12:18 PM
Matching character felixwhoals UNIX for Dummies Questions & Answers 2 01-09-2008 04:11 PM
tcl: regexp matching special character sumitgarg Shell Programming and Scripting 6 01-09-2008 03:00 PM
matching repeated character robsonde Shell Programming and Scripting 5 12-13-2007 02:43 PM
Matching a choice of character in test command lalelle Shell Programming and Scripting 2 08-20-2007 10:40 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 09-19-2000
Registered User
 

Join Date: Sep 2000
Location: Australia
Posts: 3
Exclamation

Is there a way to pull out a character at a time from a work in unix, using a shell script?
Forum Sponsor
  #2  
Old 09-19-2000
Registered User
 

Join Date: Sep 2000
Posts: 3
Cool

Depending on what exactly you're trying to do, there could be a couple ways to do it. Say you have a variable...
$VAR
...and you want to pull the 4th through the 6th character out of it. You can echo it to the screen...
echo $VAR | cut -c4-6
...or you can assign it to a variable...
CHARACTER4=`echo $VAR | cut -c4-6`
...if you don't know how many characters long the word is, you can leave the end number off the cut command...
echo $VAR | cut -c4-
...and it will echo the variable, minus the first three characters. Get it? Email me if you need more help, at ::email removed:: .
__________________
Susan K.
Unix Sun/HP System Administrator

Last edited by oombera; 02-13-2004 at 10:36 AM.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0