The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 07-02-2009
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,419
Quote:
Originally Posted by samnyc View Post
Hi,

I wrote a script, but it's not working. Please advise. I want to add the text at the end of the file. Should I use sed or awk. Not sure any thing is fine with me.


Code:
#!/usr/bin/ksh
DATE=`/usr/bin/date '+%m%d%y'` 
cp -p /etc/inittab /etc/inittab_$DATE
sed's/$/"hobbit:234:once:/etc/rc.hobbit start"/g' /etc/inittab


Thanks.
you want to add at the end of the file or the at the end of last line of the file??