Hi All,
I have a directory in which there will be several files. i want to get all the files and pass it to a piece of code for processing on the files.
This is the piece of code which does the processing.
tr "\n" "|" < (log file name) | tr "$" "\n" > output
echo ' ' >>output
while read line
do
sh ParseLog.sh "$line"
echo $?
done<output
say i have a directory /user/resin_log , how to get all the files in this directory and pass one by one to this piece of code. Saw a similar query, but couldnt derive anything from that. Please Help. Thanks in advance.
---------- Post updated at 01:10 AM ---------- Previous update was at 12:01 AM ----------
done it with this piece of code. Thank you
ls -lurt /user/resin_log | awk -F ' ' '{print $9}' > file_list
while read line
do
file_name=$line
tr "\n" "|" < (log file name) | tr "$" "\n" > output
echo ' ' >>output
while read line
do
sh ParseLog.sh "$line"
echo $?
done<output
fi
done <file_list