Hi I have file which stores dates.
2008-09-12|2008-09-12<space1>00:00:12|<space2>2008-09-12
Some one please help me on how should I use the sub command to replace only the space which has numbers on both sides.
Expected output
2008-09-12|2008-09-1200:00:12|<space2>2008-09-12
--
Thanks
I'm unaware of a sub
command, however sed
should do what you want.
Try the following
sed 's/\([0-9]\) \([0-9]\)/\1\2/g' dates_file.dat
something like this ..
echo "2008-09-12|2008-09-12 00:00:12| 2008-09-12" | sed 's/[0-9] [0-9]//g'
Hi,
This is will substitue the space and as well as the prefix and suffix of that space as blank. so you have to get those numbers and use it in replace part. As Skrynesaver did in previous post.
Cheers,
Ranga:)
Thanks all...SED wrk...Just was wondering if it was possible using awk's "sub" function...