Linux Forums - Linux Help,Advice & support community:LinuxSolved.com
Network Troublshooting => Linux Servers Support => Topic started by: vlinux1 on August 07, 2007, 07:33:54 AM
-
Hello All,
I have a simple problem I have one file that contains some data that is old file another file is new and i want to copy some data ( 10000 lines) from old file to new without overwriting the new file. I don't want to disturb
new file.
Please tell me ..........
Thnaks in Advance
Vj
-
How do you plan to copy data from the old to new file without disturbing the new file data? Are you trying to append the data. If so you could use
cat oldfile >> newfile
The >> signifies to append rather than replace.
-
hi
if you want to redirect a partial data, you can try these commands
head -1000 oldfile >> newfile
and if u want to extract data from a middle of file, you can try the ombination of head and tail or you can try below
sed '12,36!d' oldfile >> newfile
or
sed '12,36p' oldfile >> newfile
Above commands will extract the lines from 12 to 36 from oldfile and append it into new file
try both above commands as I am not very much sure about which from above sed command runs , as i dont remember much , but you can give a try above
Thanks
Gaurav