![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Is there a way to pull out a character at a time from a work in unix, using a shell script?
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
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 |