![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help with insert line into file | tarunicon | UNIX for Advanced & Expert Users | 4 | 10-13-2008 09:06 AM |
| Insert a line in a text file | 4scriptmoni | Shell Programming and Scripting | 10 | 08-04-2008 10:17 AM |
| Insert line into file | vinay123 | Shell Programming and Scripting | 3 | 07-01-2008 03:07 AM |
| insert a line in a file | RishiPahuja | Shell Programming and Scripting | 7 | 06-22-2005 03:47 AM |
| Insert a line as the first line into a very huge file | shriek | UNIX for Advanced & Expert Users | 3 | 03-09-2005 01:22 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
best way to insert a line at the top of a file?
say I want to insert "this is a test" as the first line into file A, besides
echo "this is a test" > /tmp/tmpfile cat /tmp/tmpfile fileA >> /tmp/result, is there any simple way I can do it? thanks |
|
||||
|
you can use the sed "insert" comand:
Code:
the_prompt$ cat thefile Code:
line1 line2 line3 Code:
the_prompt$ sed -e '1 i \the line you wanna put first' thefile Code:
the line you wanna put first line1 line2 line3 |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|