Originally Posted by
schragge
The code
Vaphell suggested is absolutely OK. It doing nothing only means that the pattern could not match any string in the file. Check the pattern. Probably it should not be so specific. Perhaps
Code:
pattern='^( *-- *<> *)Tue, 16 Apr 2013 18:[0-3][0-9]:[0-9]{2} -0500'
would do the trick?
As for the awk example it would work if you changed
dates.txt to
dates.
I did change dates.txt to dates.
I solved my own problem:
Code:
$ pattern="Tue, 16 Apr 2013 18:[0-3][0-9]:[0-5][0-9] -0500"
$ num=$(wc -l <dates)
$ for((i=1;i<=${num};i+=1)); do date=$(sed -n "${i}p" <dates); t=$(sed "0,/${pattern}/s/${pattern}/${date}/" <changelog); echo "$t" > changelog; done
Thanks for the input.
Bookmarks