Reverse String in Awk

Published on 07 April 2025 (Updated: 16 April 2025)

Welcome to the Reverse String in Awk page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

function reverse_string(s,  result, i) {
    result = ""
    for (i = length(s); i > 0; i--) {
        result = result substr(s, i, 1)
    }

    return result
}

BEGIN {
    if (ARGC > 1) {
        print reverse_string(ARGV[1])
    }
}

Reverse String in Awk was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.