#!/bin/ksh
# Array Reference
# Array reference 2
# Write on a file reference
# the util funciton (reverse of cat FILE) tac FILE does not work in OSX. Use tail -r FILE instead
FILES=./*.txt
for f in $FILES
do
echo "Processing $f file..."
# take action on each file. $f store current file name
#store the lines in an array
old_IFS=$IFS
IFS=$'\n'
lines=($(tail -r $f)) # array
IFS=$old_IFS
echo -n > $f # - n option writes without a new line. Here I write nothing on the file. Just overwrite the file with empty string.
for j in {9..0}
do
echo ${lines[$j]} >> $f # >> option appends on the file. > overwrites on the file.
done
done
Subscribe to:
Post Comments (Atom)
Game engines
Unity engine Unreal engine Godot engine
-
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