Apr 7, 2006 #1 dbase77 Technical User Apr 23, 2002 591 IE Hi, Anybody knows how to insert blank line at line number one in a file? Thanks.
Apr 7, 2006 #2 feherke Programmer Aug 5, 2002 9,541 RO Hi Code: sed -i '1ithe new line' /path/to/file Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Apr 7, 2006 Thread starter #3 dbase77 Technical User Apr 23, 2002 591 IE Hi, Got error "sed: illegal option -- i". Upvote 0 Downvote
Apr 7, 2006 #4 feherke Programmer Aug 5, 2002 9,541 RO Hi Needs newer GNU [tt]sed[/tt]. For example 4.1.2. Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Apr 7, 2006 Thread starter #5 dbase77 Technical User Apr 23, 2002 591 IE Dont have newer version. I guess I have to find another way of doing it. Thanks. Upvote 0 Downvote
Apr 7, 2006 #6 feherke Programmer Aug 5, 2002 9,541 RO Hi You could search this forum, the question is not new. Practically all solutions implies the creation of a temporary file. ( [tt]sed[/tt] also does that way. ) So : Code: ( echo "the new line" cat /the/file ) > /temporary/file mv /temprary/file /the/file Another way is to pipe the necessary commands to [tt]vi[/tt] and make it execute them in kind of batch mode. Again, search this forum. Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi You could search this forum, the question is not new. Practically all solutions implies the creation of a temporary file. ( [tt]sed[/tt] also does that way. ) So : Code: ( echo "the new line" cat /the/file ) > /temporary/file mv /temprary/file /the/file Another way is to pipe the necessary commands to [tt]vi[/tt] and make it execute them in kind of batch mode. Again, search this forum. Feherke. http://rootshell.be/~feherke/
Apr 7, 2006 Thread starter #7 dbase77 Technical User Apr 23, 2002 591 IE Got solution from sed using below: sed '1i\ ' test > test.out Thank you for your help. At least give me some idea. regards, dbase77 Upvote 0 Downvote
Got solution from sed using below: sed '1i\ ' test > test.out Thank you for your help. At least give me some idea. regards, dbase77
Apr 7, 2006 #8 PHV MIS Nov 8, 2002 53,708 FR Practically all solutions implies the creation of a temporary file not all: echo "O\033:wq" | vi /path/to/file >/dev/null 2>&1 Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
Practically all solutions implies the creation of a temporary file not all: echo "O\033:wq" | vi /path/to/file >/dev/null 2>&1 Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Apr 7, 2006 #9 feherke Programmer Aug 5, 2002 9,541 RO Hi Ok, then... Practically all solutions implies the creation of a temporary copy, usually in a file. Anyway, I am not so sure, that [tt]vi[/tt] will not create a temporary file. Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi Ok, then... Practically all solutions implies the creation of a temporary copy, usually in a file. Anyway, I am not so sure, that [tt]vi[/tt] will not create a temporary file. Feherke. http://rootshell.be/~feherke/