All, I am facing an issue with julian date conversion..
current command:
Code:
echo `date +%Y%j` `cat -n /home/user/FILENAME.dat |awk '{printf "%08s", $2}'`
The above command is working good. But in the above bolded part, it is converting system date to julian date.
Hi,
I'm trying to get the name of a file that has the current date in the name.
The filename is on the form A<current date>01.DC, for example A2012110501.DC
I have this script so far
Code:
date +%y%m%d
D=$(date +%y%m%d)
N=A20$D
echo $N
N2={$N}01.DC
echo $N2
And gets the following output
Quote:
A20121105
}01.DC1105
When I try to a
I have the following bash script lines in a file named test.sh.
Code:
#!/bin/bash
#
# Write Date to cron.log
#
echo "Begin SSI Load $(date +%d%b%y_%T)"
#
# Get the latest rates file for processing.
#
d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1)
filename=$d
export filename
echo "The file name is $filename."
When I execute ./test.sh
My intention is to log the output to a file as well as it should be displayed on the console > I have used tee ( tee -a ${filename} ) command for this purpose.
In my script (currently running on Solaris ) I'm testing for zero size with wild character. There are mutilple files exist in the directory.
if [ -s ${fileformat}.${date}.? ]
then
filename=`ls -1tr ${fileformat}.${date}.?
Below is a bash shell script for taking in a csv file and spitting out rows formatted the way I want (Some more changes are there, but I only kept the array affecting ones below to show).
FILENAME=$1
cat $FILENAME | while read LINE
do
OIFS=$IFS;
IFS=","
columns=( $LINE )
date=${columns[4]//\"/}
columns[13]=${columns[13]//\"/}
columns[4]=$(date -d $date +%s)
newline=${c
I want to know the appropriate way of reading date from terminal and comparing with current date using shell script,
I have the below script,
a=`date +%Y-%m-%d`
while [ 1 ] ; do
echo "Enter Date"
read todate
if [ $todate < $a ];then
break;
fi
echo "todate greater than curDate"
done
it is not running as expected.
I am getting syntax error near unexpected token done while executing my shell script:
while read filename
do
echo "$filename"
if [ -s $filename ]; then
tail -10 $filename | grep `date '+%Y-%m-%d'` >> $lastlines1
echo "- Next Error File - " >> $lastlines1
done
else
echo " no errrors"
fi
Any ideas, where am I going wrong?
This is my code:
# Generate Datetime
FILENAME="date +%Y%m%d%H%M%S"
# Dump Database
dumpdb FILENAME
# Upload to S3
python uploaddb.py FILENAME
My worry is that I want to keep referring to "FILENAME" variable except every second the variable will change its value.