#!/bin/ksh
# Function manual reference
# Array manual reference
# the util funciton (reverse of cat FILE) tac FILE does not work in OSX. Use tail -r FILE instead
function ProcessStatFile {
# Overwrite the file with nothing.
echo -n > $1
# Write the lines in reverse order
for j in {9..0}
do
echo ${lines[$j]} # the array is accessible since global. Does not need to be passed
done
}
FILES=./*.txt
for f in $FILES
do
echo "Processing $f file..."
#store the lines in an array
old_IFS=$IFS
IFS=$'\n'
lines=($(tail -r $f)) # array
IFS=$old_IFS
# Select the particular file ending with _statFile.txt
# Overwrite the file with nothing.
ProcessStatFile $f # the file name parameter is passed. Accessed as $1.
done
Subscribe to:
Post Comments (Atom)
-
To install pngwrite we need to install to helper library before we install pngwriter. 1. libpng 2. freetype2 We can use fink or macport to i...
-
Parsing and displaying dates and times is often complicated because of formatting and locale issues. Java 2 Platform, Standard Edition (J2S...
No comments:
Post a Comment