Re: can anyone see the error in this script please I am BASHing my head LOL
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Sat, 11 Mar 2006 19:19:37 -0500
On 2006-03-11, Mike wrote:
can anyone see the error in this script please I am BASHing my head LOL
while read line
do # For as many lines as the input file has...
$tmp=${line:0:1}
Do not precede a variable with '$' on the left-hand side of an assignment.
if [$tmp -ne $comma]; # if tmp is not a , then
You need spaces around '[' and ']'
then
$getdate=${line:0:9}
$theday=`date +%A -d $getdate`
See above.
$theLine=$theday "-" $thecount "," ${line:10:20}
See above, and you need to quote the entire assignment if it
contains spaces, not the individual elements.
else
$theLine=$line
See above.
fi
echo $theLine >> testoutput.txt
done < testtides.csv
exit
while read line
do # For as many lines as the input file has...
tmp=${line:0:1}
if [ "$tmp" -ne "$comma" ]; # if tmp is not a , then
then
getdate=${line:0:9}
theday=`date +%A -d $getdate`
theLine="$theday - $thecount , ${line:10:20}"
else
theLine=$line
fi
echo theLine >> testoutput.txt
done < testtides.csv
exit
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.
- Follow-Ups:
- References:
- Prev by Date: Re: Sed question
- Next by Date: Re: ls -FlagR ????/??????
- Previous by thread: Re: can anyone see the error in this script please I am BASHing my head LOL
- Next by thread: Re: can anyone see the error in this script please I am BASHing my head LOL
- Index(es):
Relevant Pages
|