How to write at specific loaction in a file

P

Pioneer

Hi,

I have to write some text in a file keeping the previous content as it
is.

e.g.
$ cat file1
abc
qwe

I want the o/p as
$ cat file1
abc
123
qwe

I want to write 123 at second line. "open" command with > and >>
options either overwrites or appends at the end.

Thanks in advance
Pioneer
 
G

Gunnar Hjalmarsson

Pioneer said:
I have to write some text in a file keeping the previous content as it
is.

e.g.
$ cat file1
abc
qwe

I want the o/p as
$ cat file1
abc
123
qwe

perldoc -q "insert a line"
 
J

Jürgen Exner

Pioneer said:
Thanks for the reply

What reply? Please quote appropriate context as has been customary for 20
years such that people have a chance to know what you are talking about.
but i dont have perldoc installed

Then I suggest you fix this broken Perl installation.
on our server.

Well, ok, as people don't develop on servers. Maybe you don't need to fix
it. But what about you development machines? Do they have broken
installations, too?

The true pioneer succeeds because he does not repeat the mistakes that
others already made.

jue
 
T

Tad McClellan

Pioneer said:
Thanks for the reply


What reply?

Please quote some context in followups like everybody else does.

[ I think the reply was one referring you to the Perl FAQ ]

but i dont have perldoc installed on our server.

That is not an excuse for posting to the Perl newsgroup without
first checking the Perl FAQ.

You must check the Perl FAQ somehow, it is easier if you have
a properly installed perl, but it appears you will have to find
the Perl FAQ some other way.

Have you tried googling for it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top