Search Results

Search: Posts Made By: chilicuil
6,576
Posted By malcomex999
Try this if you don't want to reset the index...
Try this if you don't want to reset the index position for each line...

awk '{ for(i=1;i<=NF;i++)
{ if(index($i,"alice")!=0)
printf ("%d ",index($i,"alice") + len);
...
6,576
Posted By RudiC
In case your awk version allows for string field...
In case your awk version allows for string field separators, tryawk -vSRCH=alice '
BEGIN {LNS=length(SRCH)
}
{n=split ($0, TMP, SRCH)
m=0
for (i=1; i<n; i++) ...
6,576
Posted By Don Cragun
You could also try something like: #!/bin/ksh ...
You could also try something like:
#!/bin/ksh
printf '%s\n' 'bob alice robert alice' 'aaaa bbbb aaaa' | awk -v s="$1" '
{ d = ""
for(i = 1; x = index(substr($0, i), s); i = i + x +...
6,576
Posted By Akshay Hegde
[akshay@localhost tmp]$ cat position.awk ...
[akshay@localhost tmp]$ cat position.awk
function usage()
{
print "\n\tawk -f position.awk -vsearch='word_to_be_searched' infile\n"
exit
}
BEGIN{
if(!search)usage();
}
index($0,search){
...
2,880
Posted By Walter Misar
Busybox uses its own implementation of awk,...
Busybox uses its own implementation of awk, seemingly one that uses null-terminated strings internally (as opposed to length prefixed, which could handle null characters inside strings). I used...
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 04:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy