Hi,
My input date value shuold be like : 02/12/1982
I would like to asign values to variables like :
Day: 02
Month: 12
Year: 1982
colud you please help, how can we write awk script for this.
Hi,
My input date value shuold be like : 02/12/1982
I would like to asign values to variables like :
Day: 02
Month: 12
Year: 1982
colud you please help, how can we write awk script for this.
Use the split function.
eval $(echo 02/12/1982 | awk -F/ '{printf "day=%s;month=%s;year=%s",$2,$1,$3}')
Do you need awk for that ?
Like I think danmero suggests, it can easily done in shell
Bash/ksh93:
IFS="/" read day month year <<< "02/12/1982"
ksh:
echo "02/12/1982" | IFS="/" read day month year
three < or two?
Hi rdcwayx, <<< word denotes a "here string". It is not part of POSIX but it is available in ksh93 and bash.