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
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.
Rather than reinvent the wheel, if anyone knows a shell program which does this well ,please recommend
my bash / sed program is failing at the 'mv' to the new filename
it splits the original filename into multiple tokens
my loop is as follows:
Code:
echo "extension:"
read ext
ls --quoting-style=shell *.$ext | while read x ; do
n=`echo $x|sed -e "s/$ext//"` # reserve
if [[ "${i}" = @(*P1*) ]]; then
echo "successssssssssssssssssss"
$filename = "<font color='red'>$i</font>"
else
echo "failureeeeeeeeeeeeeeeeeeeee"
$filename = "$i"
fi;
I'm just trying to see is this - read a file name and highlight it in red if it contains
Hi
I have written below script to get the data in table form.
Code:
#!/bin/sh
echo "File Name\tType"
for i in *;
do
echo "$i\t\c"
if [ -d $i ]; then
echo "directory"
elif [ -h $i ]; then
echo "symbolic link"
elif [ -f $i ]; then
echo "file"
else
echo "unknown"
fi
done
however i am getting output in different way .
Hi,
I have the code below as
Code:
cat <filename> | tr '~' '\n' | sed '/^$/ d' | sed "s/*/|/g" > <filename>
awk -F\| -vt=`date +%m%d%y%H%M%S%s` '$1=="ST",$1=="SE"{if($1=="ST"){close(f);f="214_edifile_"t"" ++i} ; $1=$1; print>f}' OFS=\| <filename>
This script replaces some characters and extracts the records
I have this simple script which redirects the output and append it to a file.
filename="/home/ronnie/tmp/hello"
date=$(date)
echo "$date" >> $filename
Now, lets suppose I change date=$(date) to date= $(date) which will generate an error.
hello,
I'm writing a php script in fedora to run with a csv file. I want the script to read column 4 and multiply each single line in the column by 1000, how would that script look?
I am new to shell scripting plz help me to get solution for below requirement
If name.sh file is present, message will be displayed as name.sh is present else "name.sh is not present"
I have tested below script but getting error.
Code:
#!/bin/ksh
file_found=`ls name.sh`
found=`echo $?`
if $found -eq 0
then
echo "$file_found is present"
else
echo "n