Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cut command

Status
Not open for further replies.

IMAUser

Technical User
May 28, 2003
121
CH
I intend to write a script something like this:

rundate=20030623

EVAL_YEAR=`cut -c1-4 $rundate`
EVAL_MMDD=`cut -c5-8 $rundate`

echo "rundate $rundate"
echo "EVAL_YEAR $EVAL_YEAR"
echo "EVAL_MMDD $EVAL_MMDD"

I need the year and the monthdate in two different variables, so was trying to use cut.

but cut seems to think 20030623 is a file and not a string of text chars.

Is there a better way of acheving the result.

Thanx
 
EVAL_YEAR=`echo ${rundate} | cut -c1-4`

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top