≡ Menu

Bash shell script to reverse text file contain using Shell array

This script also demonstrate how to use arrays under bash shell script.

{ 6 comments… add one }
  • Minakshi Kalita May 10, 2011, 5:47 am

    Thanks…………….. But i want this program using switch case

  • Anonymous January 4, 2011, 12:44 am

    tac $File | rev
    reverses output of everything, simple, both tac and rev in coreutils

  • snickers November 13, 2010, 10:52 pm

    It just reverses the ordering of the file lines. It does not reverse the actual text.

  • Shane Menshik November 12, 2009, 9:51 pm

    can’t you just do a

    tac filename.txt > filename-reversed.txt

  • vivek July 24, 2008, 7:07 am

    zakko,

    Thanks for the heads up.

  • zakko July 23, 2008, 10:54 pm

    textArray[c]=$line # store line
    isn’t it
    textArray[$c]=$line # store line
    ^
    |
    ERROR

Security: Are you a robot or human?

Leave a Comment