Reputation: 39
I have a file with dates where i want the dates to change to the day of the week using bash. I did this by the following while statement:
while read p; do
date -d $p +%A
done <dates.txt
This works fine, but now i want the output of this statement in a file, say output.txt.
I tried
while read p; do
date -d $p +%A
done <dates.txt >output.txt
But this gives the error date: extra operand '+%A'
Upvotes: 1
Views: 207
Reputation: 39
It worked, thanks for the help.
I now have
while IFS= read -r p; do
date -d "$p" +%A
done <dates.txt >output.txt
Upvotes: 2