How to add day of week at the end of each line that shows the date?

I have a file that looks like:

file1:
www_blank_com 20121008153552
www_blank_com 20121008162542
www_blank_com 20121009040540
www_blank_com 20121009041542
www_blank_com 20121010113548
www_blank_com 20121011113551
www_blank_com 20121012113542

I want the new file to show the day of week at the end of each line:

file2:
www_blank_com 20121008153552 Monday
www_blank_com 20121008162542 Monday
www_blank_com 20121009040540 Tuesday
www_blank_com 20121009041542 Tuesday
www_blank_com 20121010113548 Wednesday
www_blank_com 20121011113551 Thursday
www_blank_com 20121012113542 Friday

i thought of using sed but then I got stuck, any help?

Please see

Using shell script:-

while read url ts
do
  dt=$( echo $ts | cut -c 1-8 )
  echo $url $ts $( date -d "$dt" +"%A" )
done < infile
1 Like

perfect, thanks!