Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-19-2002, 08:59 AM   #1
LQ Newbie
Registered: May 2002
Distribution: RH 7.2
Posts: 18

Rep: Reputation: 0
append to file

I have a text file and I want to add a text satement everyday
to it.

what is the command to append text to the top of a file.


%more test.txt


I want to add 10/15/02 at the top of this file

Thanks in advance
Old 06-19-2002, 10:48 AM   #2
Registered: Jan 2002
Location: Cheyenne Wyoming
Distribution: Debian/Raspbian/Mint
Posts: 717

Rep: Reputation: 32
Well I dont know if you can put the text at the top, but you can append to the bottom with:
echo "10/15/02" >> test.txt
Old 06-20-2002, 05:55 AM   #3
Senior Member
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Well like hanzerik said you can't append to the top of a file, but you could do something like this:

  echo "10/15/02"
  cat test.txt
} > test.bak
mv -f test.bak test.txt


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
pipe output to append to a text file davee Linux - Newbie 5 03-22-2016 08:44 PM
bash programming-append single line to end of file pheasand Linux - General 4 02-28-2014 10:41 AM
c++ append data to file blizunt7 Programming 3 07-04-2005 01:47 AM
> writes a new file, how to append? luwigie Linux - General 1 08-26-2004 09:42 PM
tar append file juno Linux - General 5 10-24-2002 03:59 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:32 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration