INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

alfie002 (TechnicalUser) (OP)
9 Jan 06 11:53
Dear all,

i have used awk before and never experienced any problems. However, I am using the substr function to extract substrings from a string. Using the following format

substr(string,start_pos,end_post)

start_pos is an integer representing the start position, this works as expected.

however the end_pos is a variable which represents the length of the string minus 1 character, I want to strip of quote marks around the string.

example as follows;

print substr($field_value, 1, length($field_value -1))"

Field_value has the length of the string and I want to strip off 1 character position. However, when I run this code, instead of getting 8 characters returned I get 2 !!! This is weird and I have tried isolating the code but with no joy.

I am running it on solaris 8.

has any one experience this problem.

Thanks

Alf
PHV (MIS)
9 Jan 06 14:38
You may try to replace this:
print substr($field_value, 1, length($field_value -1))
with this:
print substr($field_value, 1, length($field_value)-1)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886

alfie002 (TechnicalUser) (OP)
10 Jan 06 14:01
thanks phv,

that worked.

Alf

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close