Hi
When running the following sed command from the command line I am able to
remove all entries with #username from the file and redirect to another file.
sed -e 's/#.*//' -e '/^$/d' namesonly > tt
mv tt > namesonly
When I use the same command in the following script I end up with the original
entries in the namesonly file. ie nothing has been removed.
echo "" > f-output.log
USERS=$(awk -F: '{print $1}' allusers)
for U in $USERS
do
finger ${U} >> f-output.log
awk '/^Logi/ {a=$3} /^Last log/ {print a, $6}' f-output.log > lastlogin
grep -v "2009" lastlogin > lastlogin_1 ; grep -v ":" lastlogin_1 | sort | uniq > newlog_1
cut -d' ' -f1 newlog_1 > namesonly
sed -e 's/#.*//' -e '/^$/d' namesonly > tt ; mv tt namesonly
done
Is there an error with this command or something else causing the problem?
Any help appreciated.