![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Substring problem | Rajat | Shell Programming and Scripting | 4 | 09-30-2008 05:06 AM |
| problem extracting substring in korn shell | nashrul | UNIX for Dummies Questions & Answers | 3 | 08-15-2007 02:45 AM |
| substring | alla.kishore | UNIX for Dummies Questions & Answers | 8 | 01-09-2007 02:57 AM |
| how to get substring | senthilk615 | Shell Programming and Scripting | 5 | 03-27-2006 05:54 PM |
| substring | Anika | UNIX for Dummies Questions & Answers | 4 | 09-19-2001 03:10 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Problem with Substring
Hi,
i have a file from which i extracted 2nd column and put it into a variable Acct_Num . Now i need to extract first 3 digits from it and save in to other variable. My Code is: while read Record1 do Acct_Num=`echo $Record1 | awk '{print $2 }'` ID=`echo $Record1 | awk '{print substr($Acct_Num, 1, 3 ) }` echo "ID is $ID" echo "Acct_Num is $Acct_Num" done < $REGSeqFileName Code to extract 2nd column from file is working fine. But the code to extract first 3 digits from Acct_Num (ID) is not working fine . Can anybody help me with this ASAP. Thanks |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|