bucci
1
Hi experts,
i have some problem with inserting text to a file, i have a file named test.log output like this :
11111 22222 33333 44444 55555
i want to insert date into the file test.log, expected output is :
20070501 11111 22222 33333 44444 55555
any idea?
please help
Thank you
Regards,
bucci
perl -i -ne ' print "20070501 $_" ' file
alternatively you could use
dt=$(date +%Y%m%d)
sed '1,$s/^/'$dt'/g file
bucci
4
Hi anbu and ahmed,
thank you for your response
it work for me now
Regards,
bucci
should be a typo..
it should be
sed '1,$s/^/'$dt' /g' file
(added a space after '$dt' as per the OP's output )
or
just this would do,
sed '/^/'$dt' /g' file