![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" | iBot | UNIX and Linux RSS News | 0 | 01-04-2008 12:00 PM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-19-2007 10:52 PM |
| Implementing "Time Limited, Trial" version of my program | the_learner | UNIX for Advanced & Expert Users | 4 | 06-07-2007 02:46 AM |
| how could i make a program mixed with many "|", "<" and ">" | strugglingman | High Level Programming | 2 | 04-29-2006 05:11 AM |
| Any limitations to the "top" command? | lawadm1 | UNIX for Dummies Questions & Answers | 6 | 07-11-2002 07:09 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Is there any limitation for the function substr()
Iam trying to assign some 11 digit number value to variable. And printing the variable. This is printing invalid values. cur_val=substr($0,36,11); printf "Current Value is: %d\n",cur_val I tried till 9 digits length, it was working fine. If I select more than 10 digits problem occurs. What could be the problem and what are the alternatives in awk script. This would be helpful for all... Thanks in advance / Lokiman |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
substr will return the substring of the string provided. I am not clear wether you want to use this function or the index function
|
|
#3
|
|||
|
|||
|
This substr() function Iam using inside the 'awk' script to assign current record position values...
|
|
#4
|
|||
|
|||
|
It may be because of %d in printf, try %ld in printf
my be in ur unix version %d is having 9 digit limitation, but for me both %d and %ld is giving same result. Just try
|
|
#5
|
|||
|
|||
|
Quote:
|
|
#6
|
|||
|
|||
|
$0 has 120 charecter length.
I think this could be the limitation with the '%d'. Are there any other reasons and alternatives? Thanks |
|
#7
|
|||
|
|||
|
till now, you have not shown your input file
|
|||
| Google The UNIX and Linux Forums |