![]() |
|
|
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. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
AWK question?
I have question about awk if someone can help me here. I want to find a string (file has just one row) and then get the position of the column.
let say i have 4 columns a b c d Look for b and somehow get the column position in this case b is at $2 script doesn't know what is the position of the column. So if awk or something else can help me to get position of the column. Thanks in Advance. |
|
||||
|
It is necesary to do it with awk?
Because a script can do it ......... cont=0 for i in `cat (the file)` do if [ `echo $i` = (the name you would like to find) ] then break; else (( cont = cont + 1 )) done echo "the position is -$cont-" ......... Bye Last edited by Doc_RuNNeR; 06-22-2006 at 10:31 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|