![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| file command | rprajendran | UNIX for Advanced & Expert Users | 3 | 05-13-2008 10:45 AM |
| rm command not able to remove file | jambesh | Shell Programming and Scripting | 7 | 12-21-2007 04:37 AM |
| VI command for File Please | $Circle$ | UNIX for Dummies Questions & Answers | 12 | 09-05-2005 01:23 AM |
| End of file using more command | Enda Martin | UNIX for Dummies Questions & Answers | 3 | 06-18-2001 07:49 AM |
| for file in ???? - command | tamer | UNIX for Dummies Questions & Answers | 10 | 01-31-2001 06:40 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
What is the command to add heading to a file?
Hi,
I'd like to add one line to the top of my file. I know there is a command to be able to do it. But I forgot ...... Please help if you can .... |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
I don't know a specific command, but this one liner works fine in sh, bash, and tcsh (a bunch of other shells too):
Code:
( echo "Line to add" ; cat targetfile ) > tempfile ; cat tempfile > targetfile ; rm -f tempfile |
|
#3
|
||||
|
||||
|
Code:
sed '1 i\ Line to insert here' infile > outfile Cheers ZB |
|
#4
|
|||
|
|||
|
existing file filename "file_one.dat"
which contains AMITH ARUN ARVIND I am adding "I LOVE PIZZA" in the first line of this file Here it is: echo "I LOVE PIZZA" | cat > tempfile ; cat file_one.dat >> tempfile ; mv tempfile file_one.dat Result: I LOVE PIZZA AMITH ARUN ARVIND |
|||
| Google The UNIX and Linux Forums |