AWK problem need help



Hi,
I am trying out an "AWK" script, to search and modify some pattern in
text file.
The script is as follows:

NR<100 {
if ( ( $6 ~ /^(x|X)/ ) || ( $4 ~ /^(x|X)/ ) ) {
printf ("PAT:%s\n", $prev)
print NR, $0
z = split($prev, lastline, " ")
if ( lastline[0] ~ /^\/\// ) {
print NR >> "bin/output.atp"
}
if ( lastline[0] ~ /repeat/ ) {
print NR, NR >> "bin/output.atp"
} else {
print NR, NR, NR >> "bin/output.atp"
}
} else {
print $0 >> "bin/output.atp"
prev = $0
}
}


My observation here is:
In else part (i.e. when I dont get the regx match, I am trying to
store the line read) in a variable, and I wnated to use it later. But
when I try printing the variable "prev" next time when I have "regx"
match, it displays the current line i.e. $0 itself

Please suggest some alternative to store the previously read line.

Akhil

.



Relevant Pages

  • Adding a new attribute!
    ... All I need from this attribute is to store a long number so that I can ... retrieve it using a script and then change it's value. ... Prev by Date: ...
    (microsoft.public.windows.server.active_directory)
  • Adding a new attribute!
    ... All I need from this attribute is to store a long number so that I can ... retrieve it using a script and then change it's value. ... Prev by Date: ...
    (microsoft.public.win2000.group_policy)
  • Returning to the field specified by the Get(ActiveField) step
    ... I know how to use the Getscript step, and I can store the ... place the summation back in the original active field.) ... Prev by Date: ...
    (comp.databases.filemaker)
  • Login scipt question
    ... I created a vb script that I want to deploy using group policy. ... good place for me to store this script? ... Prev by Date: ...
    (microsoft.public.windows.group_policy)
  • Roxanna might half warm our truck
    ... at once the script? ... store till the platform. ... Many public constitutional strokes constantly ... accurately depict Ayub and Saad's average support. ...
    (sci.crypt)