Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's wrong with this awk sytntax

Status
Not open for further replies.

hmehta

IS-IT--Management
Jun 5, 2002
27
US
Whats wrong with this synta, it always gives error at line 1

awk -v fn=web.xml.sv BEGIN'{
while ((getline arr[a++] < fn) > 0) {
m++
}

print m, &quot;records read from&quot;, fn

for (x in arr) {
if (arr[x] !~ /!!.*!!/) {
delete arr[x]
}
}
}
{
for (all in arr) {
gsub(/!!/,&quot;&quot;,arr[all])
if ($0 == arr[all]) {
$0 = &quot;!!&quot; $0 &quot;!!&quot;
}
}
print $0 > tempfile
}'web.xml
 


awk -v fn=web.xml.sv 'BEGIN{
while ((getline arr[a++] < fn) > 0) {
m++
}

print m, &quot;records read from&quot;, fn

for (x in arr) {
if (arr[x] !~ /!!.*!!/) {
delete arr[x]
}
}
}
{
for (all in arr) {
gsub(/!!/,&quot;&quot;,arr[all])
if ($0 == arr[all]) {
$0 = &quot;!!&quot; $0 &quot;!!&quot;
}
}
print $0 > tempfile
}'web.xml
 
It still gives me :
awk: syntax error near line 1
awk: bailing out near line 1
 
copy/paste the code in a.awk and debug it from there

vlad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top