Skip to content

Tag: file

What is a better way to read each line in a file in linux?

Hi all, I want to read each line in a file and then make a whole url to do some thing. The above scripts worked, but what is a better way to read file line by line? Thanks. Answer This is a nice example of the useless use of cat, simply use IO redirection: The use of -r in read

C: strtok and newlines in Windows vs Linux

I’m working on a C school assignment that is intended to be done on Windows, however, I’m programming it on OS X. While the other students working on Windows don’t have problems reading a file, I do. The code provided by the tutors splits the contents of a file on n using this code: However,…

I read more than I write in file

I have a file, partitioned in fixed sized blocks. I am copying a test_file.txt into the 3rd block of the file. I read and copied 18 bytes. Then I am trying to copy from the file that very same .txt file I just imported to a newly created .txt, but I am writing 256 bytes to the new file. Moreover,

How do I do a one way diff in Linux?

How do I do a one way diff in Linux? Normal behavior of diff: Normally, diff will tell you all the differences between a two files. For example, it will tell you anything that is in file A that is not in file B, and will also tell you everything that is in file B, but not in file A.

Alternative to writing many files. MongoDB?

I have a Perl script that produces ~10000 files in the 1kB – 10kB size area, which is not optimal for performance, so I though about using MongoDB instead of writing the many files. I need to run the script on my laptops Linux and OSX. Question Would MongoDB be overkill? Or are there something more suit…