Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat go.awk
- BEGIN {
- print "The BEGIN block is executing"
- print reverse("The BEGIN block is executing")
- }
- {
- print reverse($0)
- }
- function reverse(str) {
- trs=""
- for(i=length(str); i > 0; i--) {
- trs=trs substr(str, i, 1);
- }
- return trs
- }
- $ cat input
- line one
- line two
- line three
- $ awk -f go.awk < input
- The BEGIN block is executing
- gnitucexe si kcolb NIGEB ehT
- eno enil
- owt enil
- eerht enil
Add Comment
Please, Sign In to add comment