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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

awk stringlength to shell

Status
Not open for further replies.

bdittmar

IS-IT--Management
Jun 4, 2003
2
DE
Must use /bin/sh (HP-UX 11i)

The variable $1 (string) has variable string length.
This length must be stored in a varable like $bl in the shell.

with echo $1 | awk '{print length($1)}' the variable length can be determined.
But how can i get this value back to the shell as $bl

Any idea ??
 
Use back-ticks ``
Code:
bl=`echo $1 | awk '{print length($0)}'`
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top