Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to read lines one character at a time 1

Status
Not open for further replies.

Birbone

MIS
Dec 20, 2000
141
US
What command can I use to pull out just the 3rd and 7th characters of a filename and assign them to individual variables? value1=$slot3 and value2=$slot7 -Bobby s-)
bwgunn@icqmail.com
 
Bobby:

One way is to use the cut command. If I'm interpreting correctly and using ksh:

filename=1234567890
value1=$(echo $filename|cut -c3)
echo $value1
value7=$(echo $filename|cut -c7)
echo $value7

Regards,

Ed
Schaefer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top