
05-11-2007
|
 |
Moderator
|
|
Join Date: Feb 2005
Location: Boston, MA
Posts: 3,180
|
|
Quote:
|
Originally Posted by jim mcnamara
Code:
#!/bin/ksh
okay=$(head -1 $1 | awk '{print substr($0, length($0)-2)}' | \
awk '{print index("001|004|007",$0)}')
if [[ $okay -gt 0 ]] then
print "okay"
else
print "not okay"
fi
|
jim nice idea, it does not work - at least not with Solaris's 'nawk'.
Couple of things: - the 'index' signature is wrong: index(s,t): Return the position, in characters, numbering from 1,
- 't' is a STRING and not a regex (at least on Solaris' "nawk"
|