the question:
how to find a character position in a word/line?
eg.
Unix forum is the best site.
now in above line i want to find the character 'x' position
i.e 4
this is what i came up with:
$ echo "Unix forum is the best site." | grep -o "[-_a-zA-Z0-9\.]" | grep -n x
4:x
update:4:x
one of the users has a very simple solution:
$ expr index "Unix forum is the best site." x
4
4
3 comments:
sungguh linux blog ami ini...
miss ko la ami...
hahaa..
takde ko oscc xde seri..
:))
bravo!...
ami now become script gurus
How to get the same in KSH? Because option -- o is not there in that..
Post a Comment