![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Sed question
My data file look like tis
field1:field2:field3:field4:field5 I wan to compare field 2 with 1 variable and if match change the details of it. How can i do it? I used to do it like tis: #in shell script checkSerial() { while [ "$counter" != "correct" ] do echo " [7;31H \c" echo " [7;31H \c" ; read serial awk -v awk_serial=$serial aSerial.awk data.dat | read counter echo $counter if test "$counter" != "correct" then echo " [8;31H Serial number already exist!\c" fi done counter="" } #aSerial.awk BEGIN { FS = ":" } { if ( $2 == awk_serial ) flags=1 } END { if ( flags != 1 ) printf "correct" } Pls correct my mistake coz this seems like dun work....thx |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|