General :: Overwrite The Header Of A File Without Copying The Whole File?
Mar 1, 2011
Asuming I have two files, one large file and one small file, I want to write the smaller file to the large file without overwriting the remaining part of the larger file.
Both are binary files, and the large file can become very large, so I want to avoid copying the whole file, as that will take some time. Is there any standard Linux console utility to do this, or do I need to write it myself?
We have some large files with sampling data in it. Don't want to delete these files. But want to quickly overwrite the file with 0s and/or 1s and preserve the original file size.
I try to write to a file "date > file" but Linux says 'cannot overwrite existing file'. I tried chmod 755 but still cannot write to the file. What should I do?
For example I want a file to be processed by sed, and then overwrite the file with sed's output. I would try this: Code: sed '<regex goes here>' myfile > myfile But it doesn't work as expected, instead it empties the file (I am thinking that as the first byte comes out of sed, it overwrites the whole file and sed has nothing more to do). How can I make this work?
I am new to ubuntu.I have done some programming in c++ under windows using graphics.h header file.I want to implement my programs in ubuntu.How can i do this?I am writing a program.
I am having problems with scp during a backup operationI added a ps -ef before and after the scp operation used during the backup.The backup is a script to backup a Zimbra ServerI am including the code segment that I am having problems
Code: # DRCP Section. To scp newly created archives to a remote system if [ "$DRCP" = "yes" ]
When I try to copy PDF files from one folder to another folder, it give me this error: "Error while copying "2004-SNUG-Europe-paper_...log_DPI_with_SystemC.pdf". There was an error copying the file into /media/CCDCE66BDCE64F70/Backup Master/Heterogeneous_cosimulation/Documentation" "Error splicing file: Input/output error" What is the reason of this error and how can this be fixed?
I have a 7.2 GB file (VMWare virtual machine file) that I am trying to copy from its original location to the another folder OR to external hard drive...each time I try to do this, I always get the following error after the copying process reach 'exactly' 1.4 GB
Error reading from file input/output error
And I have to either Cancel or Skip
I've tried to split the files to smaller pieces but the idea didn't work as I still get the same error whenever I try to compress/ split or do any operation with this file. how I can copy this file?
I want to know how can I use sender an receiver of the email in name of file for storing mail in procmailrc. I made one but it does not work.
Quote:
SUBJECT=`formail -xSubject:` # regular field FROM=`formail -rt -xTo:` # special case :0 b * ^FROM.* | sed -e '/^To: +?[0-9]*$/,/report/!d' > ${FROM}${SUBJECT}--`mktemp 20`date +%y-%m-%d-%S--`XXXXXX`
it works when I use :
Quote:
| sed -e '/^To: +?[0-9]*$/,/report/!d' > `mktemp 20`date +%y-%m-%d-%S--`XXXXXX`
copying permissions from one file to another.I know that command for changing permission is "chmod", for example chmod 666 filename However, I have one file filename1 and by listing all contents of a directory with ls -al I can find out its permissions in form -rwwx and similar. Now I want to define exact same permissions to other file "filename2". How to use chmod command to accomplish this. Other way around would be to simply copy permissions from one file to another. Is there any command for this purpose?
The current directory contains:A file called "original.txt" Many directories called "source_001", "source_002", "source_003" ... From the command line how do you copy "original.txt" to "source_001" and "source_002" and "source_003" ...
The total number of these source directories is unknown, it changes every week.
Solaris is the os used. I want to copy files from UNIX Machine to windows network drive.I know smbclient,ftp can be used. But is there any other best option i can use?
I am trying to copy four files from my machine, through a second machine, and finally to the destination. The destination computer can only be reached through the second computer, and I am curious to know if there is an easy way to do this. I am able to ssh to the middle machine and then ssh from there to the destination. I know that I could just copy from the first machine to the second, and then from there to the third. I guess that I'm curious to know what kind of command I can run to do this all at once or even if I could do such a thing (which I'm betting I can). I need to copy these files as root on the destination machine too.
I am quite confused about the following description on fork. Could you please explain it ?The child process shall have its own copy of the parent's file descriptors. Each of the child's file descriptors shall refer to the same open file description with the corresponding file descriptor of the parent.For example, I am opening a socket and then fork. Now, does the child have a separate socket or is shares it with the parent. Does I have any impact on using it in child?
I'm trying to resume copying from a mounted CIFS device to my local hdd with cURL. I tried
Code: $ curl -C - -O file://myfile and also
Code: $ curl -C <manual offset> -O file://myfile (looked up the manual offset using "$ wc -c")
This resumes copying if I cancel it eg with ^C.
But it does not work if I unmount and remount the CIFS device. cURL then ignores my given offset and continues again from start as if nothing were there without saying a word. With "-C -" the same effect.
Code: dd bs=8192 if=Image of=/dev/PS0 In the above command, I cant able to understand the option "of=/dev/PS0"
Whether it means, 1) to write the input file "Image" in to "/dev/PS0" of the Floppy device or 2) to overwrite the same input file "Image" in a file format ("/dev/PS0") of Floppy.
Create a copy of the file above and call it commands.sorted. Use the vi command to manually sort this file. I.e. use yy to copy a line, P or p to paste a line, and dd delete a line. Order the commands with the two lines starting with double quotes first. Then list the rest of the command in alphabetical order.
Anyone have any ideas what he's talking about? Can I copy a file and rename it at the same time while copying it to the same exact directory again? Now sure what the two lines things means either. I have an email out to him but it usually takes a long time for him to answer me. I got alot of work to do so everytime I get hung up it kills me.
I'm getting some funny behavior from ffmpeg when I'm trying to increase the volume of an mp3 file and have it overwrite itself. For example, if I execute the following command:
Code: ffmpeg -i name.mp3 -vol 1024 -y name.mp3
it will code the first 5 seconds or so and then quit with:
I have written a spec file for packaging my application in an rpm, but it reports a conflict when I am trying to update my service script in /etc/init.d/. This is a file that I do need to update/replace so how might I force the rpm to do that?
Code:
Summary: A program that increases WAN performance. Name: packetsqueezer Version: 0.3.05 Release: 1
I've recently left Windows behind for good and have come to Linux (Ubuntu.) However, I've run into problems after trying to dual boot windows 7 and ubuntu. When I restarted my computer, I got a black screen with white text reading "Minimal BASH-like line editing is supported". I have the Ubuntu live cd and was able to try Ubuntu without having to install it, but after I put in a flash drive with Windows 7 on it, the Ubuntu CD has stopped working entirely.
The weird thing is, the computer that I installed Ubuntu on, already had Ubuntu and Windows 7 on it. And every OS was booting successfully. The reason I deleted the Ubuntu that was already on the computer, is because there were many different versions. I wanted to do a clean sweep and only have Ubuntu and Windows 7 installed on the computer. I know that if you try to dual boot Windows 7 and Ubuntu, Windows will overwrite the GRUB file, making it unable to dual boot.
I am trying to copy a 7.3gb .iso file to an 8gb USB stick and I get the following error when it hits 4.0gb
Error while copying "xxxxxx.iso". There was an error copying the file into /media/6262-FDBB. Error splicing file: File too large The file is to be used by a windows user, and I'm just trying to do a simple copy, not a burn to USB or anything fancy. Using 10.4.1.LTS, AMD Dual Core, all latest patches.
I was trying to install usb-modeswitch edora-14 (64 bitt saidCode:usb_modeswitch.c:56:17: fatal errr: usb.h: No such file or directoryWhen I tried to install libusb, it said that it is already installed and is the latest version. But, it still doesn't show usb.h in /usr/include directory.What shall I do to make usb-modeswitch?
I am having trouble getting some code to work. It takes an input file (csv) and converts it to an XLS. The problem is that I can't seem to get a header to be printed first...
Code: use Spreadsheet::WriteExcel; my $input = $ARGV[0];