Search Results

Search: Posts Made By: manushi88
4,561
Posted By 47shailesh
thanks for pointing it out, made appropriate...
thanks for pointing it out, made appropriate correction in post#2
4,561
Posted By methyl
In addition to the above posts, the script in...
In addition to the above posts, the script in post #1 contains obvious typing errors. The inconsistent spelling of all references to what probably should be $UPDATE .
4,561
Posted By Scrutinizer
The proper advice would be to use weak quotes ...
The proper advice would be to use weak quotes
ls "$FILE" | grep -v "$UPDATE.csv"
4,561
Posted By neutronscott
Better to use find if it has -mtime: find...
Better to use find if it has -mtime:


find . -name '*.csv' -mtime +1 -exec rm {} \;


That would delete .csv files older than 1 day.
4,561
Posted By 47shailesh
loose the quotes and ^ . Quotes wont allow your...
loose the quotes and ^ . Quotes wont allow your variable to expand, and ^ searches for file name starting with variable name, which in your case is at the end/middle. use following
ls $FILE | grep...
4,561
Posted By methyl
#!/bin/ksh DATE=`date +"%d%h%Y"` ...
#!/bin/ksh

DATE=`date +"%d%h%Y"`
DIR="/data/rfs/"
FOLDER="Test"
TARGET="${DIR}${FOLDER}"

UDATE="$(echo $DATE | tr '[a-z]' '[A-Z]')"

ls "${TARGET}" 2>/dev/null | grep -v "${UDATE}" | while...
4,561
Posted By 47shailesh
ls $FILE | grep -v "$UPPDATE" will list files...
ls $FILE | grep -v "$UPPDATE" will list files other than todays date check -v option of grep.
Other alternative to delete such files is
find $FILE -maxdepth 1 ! -name \*"$UPPDATE"* -exec rm {} \;
Showing results 1 to 7 of 7

 
All times are GMT -4. The time now is 11:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy