Hmm.  That sounds similar, but not identical to your original post. Can you
clarify your question by giving an example, using a small dataset for both
input and expected output? - Robert

On Mon, Jan 4, 2021 at 10:44 AM alig...@gmail.com <aligam...@gmail.com>
wrote:

> Hi Robert,
>
> I want to copy line 5  from a file to line 3 in another file
>
> Thanks in advance
> On Monday, January 4, 2021 at 5:51:31 PM UTC+2 Robert Citek wrote:
>
>> Without example data, it's not completely clear what you are trying to
>> do.  But this might be one of many ways to accomplish what you are trying
>> to do:
>>
>> $ { head -4 test.dat ; sed -n 3p w.dat ; tail -n +5 test.dat ; } | cat -n
>>      1 b1
>>      2 b2
>>      3 b3
>>      4 b4
>>      5 a3
>>      6 b5
>>      7 b6
>>      8 b7
>>      9 b8
>>     10 b9
>>     11 b10
>>
>> Sample data:
>>
>> $ paste w.dat test.dat  | cat -n
>>      1 a1 b1
>>      2 a2 b2
>>      3 a3 b3
>>      4 a4 b4
>>      5 a5 b5
>>      6 a6 b6
>>      7 a7 b7
>>      8 a8 b8
>>      9 a9 b9
>>     10 a10 b10
>>
>> Regards,
>> - Robert
>>
>> On Mon, Jan 4, 2021 at 8:02 AM alig...@gmail.com <alig...@gmail.com>
>> wrote:
>>
>>> Hi,
>>> I want to copy a line from a file to a specific line number in a file.
>>>
>>> I copy line 3 from w.dat file to test.dat file using
>>>
>>> sed -n 3P w.dat >> test.dat
>>>
>>> but it copy line 3 to the end of test.dat file, I want copy line 3 to
>>> line number 5 in the test.dat file, how can I do that?
>>>
>>>
>>> --
> --
> You received this message because you are subscribed to the Linux Users
> Group.
> To post a message, send email to linuxusersgroup@googlegroups.com
> To unsubscribe, send email to linuxusersgroup+unsubscr...@googlegroups.com
> For more options, visit our group at
> http://groups.google.com/group/linuxusersgroup
> References can be found at: http://goo.gl/anqri
> Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules)
> ---
> You received this message because you are subscribed to the Google Groups
> "Linux Users Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to linuxusersgroup+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/linuxusersgroup/39b6524a-fa47-4a91-8c66-93bd19393e62n%40googlegroups.com
> <https://groups.google.com/d/msgid/linuxusersgroup/39b6524a-fa47-4a91-8c66-93bd19393e62n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to linuxusersgroup@googlegroups.com
To unsubscribe, send email to linuxusersgroup+unsubscr...@googlegroups.com
For more options, visit our group at 
http://groups.google.com/group/linuxusersgroup
References can be found at: http://goo.gl/anqri
Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules)
--- 
You received this message because you are subscribed to the Google Groups 
"Linux Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linuxusersgroup+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/linuxusersgroup/CAKFjdm6YA0%3DotwX_qZLQw0DQ3PeogwSoSe_1CAvdckg4cFJsCw%40mail.gmail.com.

Reply via email to