PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21
PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21
PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21
PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21
PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21
Total number of rows: 5
<<Blank line >>
<<Blank line >>
<<Blank line >>
Now I want to delete the last non blank line ( Total number of rows: 5 )
and paste the remaining text in to another file. so the another file should look like below.
PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21
PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21
PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21
PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21
PGW|PGW_CDR_|2017-06-23 141946|2017-07-17 131633|2017-08-21
<<Blank line >>
<<Blank line >>
<<Blank line >>
The awk utility would be one way to do this. The ed and ex utilities could easily be used to do this in a shell script. The vi utility is an excellent way to do this if you want to do it interactively.
Depending on what operating system you're using, you might want to use the tac utility if your operating system includes that utility. You could do this entirely in the shell command language, but it would be easier with some shells than it would be with others.
There are probably thousands of ways to do this on most UNIX and UNIX-like operating systems. Without knowing what shell and operating system you're using, what experience you have, and what you have tried to solve this problem on your own it is hard to make any meaningful suggestions.
The awk script you showed us does not print the last non-blank line; it prints the last non-empty line. Do you understand the difference? Which is it that you want to delete? A non-blank line or a non-empty line?