10
2
In bash script,
I have a string which contains several words separated by one or more than one spaces. ie:
Name Age Sex ID Address
If I want to find any of the word, for instance I want to find the index of word "Age", how can I do it?
Is there any command that will return the index number of the word I want directly?
Thanks.
Related post: How to print certain columns by name?
– zx8754 – 2019-07-18T07:24:19.200Does the solution have to be strictly in bash? Or can awk, grep, etc. be used? – jftuga – 2012-06-09T06:57:44.817