I am new to awk and have created a very simple script. It should read file lines into an array and print all lines in the END block. But when I test it nothing prints except the counter value:
1:: (should be something here ...)
2::
3::
4::
...
Could someone please tell me what I am doing wrong? It's probably something simple, but its making me crazy!
1:: (should be something here ...)
2::
3::
4::
...
Could someone please tell me what I am doing wrong? It's probably something simple, but its making me crazy!
Code:
BEGIN {
FS="*"
RS="\r"
counter=1
}
{
arr[$counter] = $0
counter = counter + 1
#print arr[$NR]
}
END {
for (x = 1; x < counter; x++) {
print x "::" arr[1]
}
}