![]() |
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 in shell script | jyotib | Shell Programming and Scripting | 5 | 01-16-2008 07:58 PM |
| help for shell script of finding shortest substring from given string by user | pankajd | Shell Programming and Scripting | 1 | 11-22-2007 12:27 PM |
| Substring in Shell Script | smartbuddy | UNIX for Dummies Questions & Answers | 3 | 08-17-2007 09:26 AM |
| command/script to extract a substring from a string | girisha | Shell Programming and Scripting | 5 | 09-21-2006 12:30 PM |
| Substring in C shell script? | dinodash | Shell Programming and Scripting | 0 | 03-20-2005 01:59 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi All,
I am new to this shell scripting world. Struck up with a problem, can anyone of you please pull me out of this. Requirement : Need to get the index of a substring from a parent string Eg : index("Sandy","dy") should return 4 or 3. My Approach : I used Awk function index to achieve this when i excecute this in command line awk 'BEGIN { print index("Attempting to connect to ipaddr: 127.0.0.1 IllegalUrl_110707092804.txt Succeeded with no errors.","Succeeded with no errors") }' 72 if gives me correct output which is 72 but in shell script it always returns 0. $a="Attempting to connect to ipaddr: 127.0.0.1 IllegalUrl_110707092804.txt Succeeded with no errors." $b="Succeeded with no errors" echo "`awk 'BEGIN { print index($a,$b) }'` " Can anybody please tell what is the problem or suggest an alternate approach. Many Thanks, Sandeep |
|
||||
|
Hey Radoulov,
Thanks a lot ![]() Thanks, Sandeep |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|