Computing.Net > Forums > Unix > How to display 1 character from str

How to display 1 character from str

Reply to Message Icon

Original Message
Name: thomas leung
Date: September 8, 2006 at 23:27:46 Pacific
Subject: How to display 1 character from str
OS: Unix
CPU/Ram: P4
Comment:

Sir,

I want to display 1 character from a string, how to do it?
Example:
str='abcdefghijk'

How to extract the character -- "c" from the str and display it?

Please advise.
thanks!
regards,
thomas



Report Offensive Message For Removal

Response Number 1
Name: lchi2000g
Date: September 9, 2006 at 16:23:24 Pacific
Subject: How to display 1 character from str
Reply: (edit)


echo $str | cut -c3

Luke Chi


Report Offensive Follow Up For Removal

Response Number 2
Name: thomas leung
Date: September 12, 2006 at 04:40:34 Pacific
Subject: How to display 1 character from str
Reply: (edit)

Luke Chi,
Thanks to your help.

regards,
thomas


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: How to display 1 character from str

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software