How do I make the below ksh to process all of the files inside a user specified directory?
Currently it can only process one file at a time.
#!/bin/ksh
tr -s '\11 ' ' ' < $1 > temp0
sed -e 's/,//g' temp0 > temp1
cut -d' ' -f1,4,5 temp1 > final_output
rm temp0 temp1
vino
2
This should work
for file in /dir/to/process/*
do
tr -s '\11 ' ' ' < $file > temp0
sed -e 's/,//g' temp0 > temp1
cut -d' ' -f1,4,5 temp1 >> final_output
rm temp0 temp1
done
1 Like
Thank you Vino!
It worked.
You really dont need "rm temp0 temp1" in the loop. You can use rm outside the loop.