Question: Please help with 4 or 5, both if possible. THANKS! You don't need advanced features of AWK for these scripts. Do not use 'getline' or

Please help with 4 or 5, both if possible. THANKS!

Please help with 4 or 5, both if possible. THANKS! You don't

need advanced features of AWK for these scripts. Do not use 'getline'

You don't need advanced features of AWK for these scripts. Do not use 'getline' or 'next', and stick to basic AWK programming. Your awk programs will be run on the output of an OSTEP simulator. Here's an example. ptr[2] = Alloc(5) returned 1001 (searched 3 elements) Free List [ Size 3 ]: [ addr:1000 sz:1 ] [ addr:1006 sz:2 ] [ addr:1008 sz:92 ] ptr [3] Alloc(8) returned 1008 (searched 3 elements) Free List [ Size 3 ]: [ addr:1000 sz:1 ] [ addr:1006 sz:2 ] [ addr:1016 sz:84 ] Free (ptr [3]) returned o Free List [ Size 4 ]: [ addr:1000 sz:1 ] [ addr:1006 sz:2 ] [ addr:1008 sz:8 ] [ addr: 1016 Sz: 84 ] 4. Write an awk script succ_reqs.awk that prints the number of bytes requested, and then a 1 or a depending on whether the request was successful (1 means success). Your program should act like this: $ awk -f succ_reqs.awk malloc-out.txt | tail -5 51 71 1 1 10 0 61 Hint: Again, consider writing separate patterns for the success and failure cases. 5. Write an awk script list_sizes.awk that prints the size of every element in the free list, in order, after each Free or Alloc operation. Your program should act like this: $ awk -f list_sizes.awk malloc-out.txt | head 99 1 99 1 92 1 7 92 1 2 92 You don't need advanced features of AWK for these scripts. Do not use 'getline' or 'next', and stick to basic AWK programming. Your awk programs will be run on the output of an OSTEP simulator. Here's an example. ptr[2] = Alloc(5) returned 1001 (searched 3 elements) Free List [ Size 3 ]: [ addr:1000 sz:1 ] [ addr:1006 sz:2 ] [ addr:1008 sz:92 ] ptr [3] Alloc(8) returned 1008 (searched 3 elements) Free List [ Size 3 ]: [ addr:1000 sz:1 ] [ addr:1006 sz:2 ] [ addr:1016 sz:84 ] Free (ptr [3]) returned o Free List [ Size 4 ]: [ addr:1000 sz:1 ] [ addr:1006 sz:2 ] [ addr:1008 sz:8 ] [ addr: 1016 Sz: 84 ] 4. Write an awk script succ_reqs.awk that prints the number of bytes requested, and then a 1 or a depending on whether the request was successful (1 means success). Your program should act like this: $ awk -f succ_reqs.awk malloc-out.txt | tail -5 51 71 1 1 10 0 61 Hint: Again, consider writing separate patterns for the success and failure cases. 5. Write an awk script list_sizes.awk that prints the size of every element in the free list, in order, after each Free or Alloc operation. Your program should act like this: $ awk -f list_sizes.awk malloc-out.txt | head 99 1 99 1 92 1 7 92 1 2 92

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!