I have date in format YYYY-MM-DD in variable 'a'. I want to convert it in format YYYYMMDD and store in variable 'b'. The variable is in an awk variable.
How can I do the same ?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
a="YYYY-MM-DD" b=a gsub("-", "", b) print(b)
gsub replaces the first argument with the second in the third, in-place, so we copy the value of
b first. We replace the
- characters with nothing.