I am using cat *.txt to merge multiple txt files into one, but I need each file to be on a separate line.
What is the best way to merge files with each file appearing on a new line?
I've been tinkering with a regex answer by yukondude with little success. I'm trying to kill processes that are older than 10 minutes. I already know what the process IDs are. I'm looping over an array every 10 min to see if any lingering procs are around and need to be killed. Anybody have any quick thoughts on this?
Thanks, Steve
ps -eo uid,pid,etime 3233332 | egrep ' ([0-9]+-)?([0-9]{2}:?){3}' | awk '{print $2}' | xargs -I{} kill {}
I've been tinkering with the answer posted by yukondude with little success. I'm trying to kill processes that are older than 10 minutes. I already know what the process IDs are. I'm looping over an array every 10 min to see if any lingering procs are around and need to be killed. Anybody have any quick thoughts on this?
Thanks, Steve
I have a plain text file with words, which are separated by comma, for example:
word1, word2, word3, word2, word4, word5, word 3, word6, word7, word3
i want to delete the duplicates and to become:
word1, word2, word3, word4, word5, word6, word7
Any Ideas? I think, egrep can help me, but i'm not sure, how to use it exactly....
Hopefully this is programming related.
Many people have reported that the NTFS-3G driver works perfectly for writing to NTFS drives without any problems.
If NTFS has been successfully reverse engineered to a useful degree, then why is the kernel driver still only read-only, with write support being very dangerous.....just as it was 5 years agi?
I was wondering how to merge two single column csv files into one file where the resulting file will contain two columns.
file1.csv
first_name
chris
ben
jerry
file2.csv
last_name
smith
white
perry
result.csv
first_name,last_name
chris,smith
ben,white
jerry,perry
Thanks
__thread Foo foo;
How is "foo" actually resolved? Does the compiler silently replace every instance of "foo" with a function call? Is "foo" stored somewhere relative to the bottom of the stack, and the compiler stores this as "hey, for each thread, have this space near the bottom of the stack, and foo is stored as 'offset x from bottom of stack'"?
Dear all,
we are receiving about 10000 messages per hour. We store them as individual files in hourly directories on an ext3 filesystem. The file name includes a sequence number. We use rsync to mirror these files every 20 seconds at another location (via a SAN, but that doesn't matter).
Sometimes an rsync run picks up files n-3, n-2, n-1, n+1, and then next rsync run continues with n, n+2, n+3, n+4 and so on.
Is it possible that when one process creates files in a certain sequence within a directory, that another process using readdir() sees the files appearing in a different sequence?
Kind regards,
Sebastian
I need files to be <= 5GB to put on S3.
Right now I have an ugly tar / gzip / cut before upload, then cat / zcat / tar on download, but it's really ugly - and nearly every archiver should support archive splitting right?
What's the best way?
I am trying to create a small assembly program to create a folder. I looked up the system call for creating a directory on this page: http://www.ctyme.com/intr/rb-8144.htm
It says that it is identified by 27h. How would I go about implementing the "mkdir somename" in assembly? I am aware that the program should move 27 into eax but I am unsure where to go next. I have googled quite a bit and no one seems to have posted anthing about this online. This is my current code (I don't know in which register to put filename and so on)
section .data
section .text
global _start
mov eax, 27
mov ????????
....
int 80h
Thanks
Hi,
I am running multiple screens from one ssh connection, when I list all of the screens via screen -ls the names are not very descriptive and when I have multiple screens it becomes hard to remember what is running on each. Does anyone know how to name these sessions (preferably when creating the screen).
Thanks
Hi !
I would like to know how to log the login and logout of a user.
I know it's possible to use the command "last". But this command is based on a file that has a r/w permission for the user, hence the possibility to change these data.
I would like to log these data over two months.
Why would I like to do that ? In fact, I would like to prevent a normal user to use a computer more than an hour a day - except week-ends, and 10 hours in total a week.
Cedric
System used : kubuntu,
Programming language : bash script
Hey guys,
I occurred a really weired problem, which is touch : command not found.
I was going to create a blank file, so I type the touch command which didn't work.
I'm running centOS 5.
Any ideas?
BTW: the vi command also not found.
how do i find a string in files in a directory. And these file names begin with letter a.
I also want to get the number of occurrences of this string fromt he grep I run.
I tried this
cat * | grep -c string but it searches all files. I just want to search files that begin with letter a
Thanks
Hey guys,
Recently I've been noticing an increase in the size of the core dumps generated by my application. Initially, they were just around 5MB in size and contained around 5 stack frames, and now I have core dumps of 2GBs and the information contained within them are no different from the smaller dumps.
Is there any way I can control the size of core dumps generated? Shouldn't they be at least smaller than the application binary itself?
Binaries are compiled in this way:
Compiled in release mode with debug
symbols (ie, -g compiler option in
GCC).
Debug symbols are copied onto a
separate file and stripped from the
binary.
A GNU debug symbols link is added
to the binary.
At the beginning of the application, there's a call to setrlimit which sets the core limit to infinity -- Is this the problem?
Creating a ruby on rails site that uses RMagick to create thumbnails for many types of images. RMagick cannot read dwg files however.
I've tried a few things, looked into the Java library JDWGLib, which would probably allow me to write a converter, but it would be a total from the ground up solution, where I just need a thumbnail.
Also considered using a viewer program to open the file in a remote X session and do a screen capture, however I'm not sure how I could ever guarantee that the viewer had completed opening when I took the screenshot.
I'm not concerned with being able to manipulate the file other than to create the thumbnail. It is going to be used for commercial purposes, so any libraries used need to be compatible.
I am trying to use the new facebook api and it requires libcurl PHP. I used
sudo apt-get install php5-curl
sudo apachectl -k restart
And it didn't work. I get the same error and the phpinfo() page says nothing about libcurl.
The source of this problem is probably that I built some of the tools from source (apache2, php), but then I got bored so installed a lot of the extensions with the package manager. But I'm not exactly how to go about diagnosing the point of failure.
The apt-get install for curl definitely worked, and can be found in
/usr/lib/php5/20060613/curl.so
I think a lot of my confusion stems from not knowing which files go where, and what purpose they have. Any help would be appreciated, and please tell me if I need to provide more information.
edit:
The specific error I get is:
Exception: Facebook needs the CURL PHP extension.
from line
if (!function_exists('curl_init')) {
throw new Exception('Facebook needs the CURL PHP extension.');
}
Ubuntu: 9.10
PHP: 5.2.13
Loaded Configuration File: /etc/php5/apache2/php.ini
Hi
I wanted to try out the splice syscall. I have this function - it should copy content of one file to another:
static void test_splice( int in, int out ) {
int i = 0, rcvd = 0;
int filedes[2];
off_t off = 0;
if ( pipe( filedes ) < 0 ) {
perror( "Kicha pipe" );
exit( EXIT_FAILURE );
}
for ( i = 0; i < NUMLOOPS; ++i ) {
if ( ( rcvd = splice( in, NULL, filedes[1], NULL, BUFSIZE, SPLICE_F_MORE | SPLICE_F_MOVE ) ) < 0 ) {
perror( "splice" );
exit( EXIT_FAILURE );
}
if ( splice( filedes[0], NULL, out, NULL, rcvd, SPLICE_F_MORE | SPLICE_F_MOVE ) < 0 ) {
perror( "splice" );
exit( EXIT_FAILURE );
}
}
}
The second call to splice in first iteration returns EINVAL ( invalid argument from perror ) everytime - what could be the reason?
I'm working on an embedded system which is going to be booting and hosting it's rootfs on an SSD disk. We are currently looking at using Intel X-18M SSDs.
The file system structure will have a fairly static /usr section (modulo software upgrades) and an active /var and /var/log for maintaining state and logging. Given the wear-levelling done by the underlying flash does having separate partitions help or hinder?
As modern SSDs appear as straight block devices and hide their mapping magic behind their firmware is there any point trying to optimise the choice of file-system that sits on-top of the SSD?
Finally does enable SMART monitoring make any sense in this context or are their SSD specific ways of determining the underlying health of the storage hardware?
Hello folks.
Tonight I am working on my music collection. I would like to resample a large selection of my MP3's to 192Kb/s for my Zune. I know the obvious way to do this is a recursive function using lame to encode MP3 at 192 - but lame doesn't maintain the ID3 tags!
Does anyone know of another option that will retain ID3 info?
Thank you all for your time / help!
We transit from ring3 to ring0 using 'int' or the new 'syscall/sysenter' instruction. Does that mean that the page tables and other stuffs that needs to be modified for the kernel is automatically done by the 'int' instruction or the interrupt handler for the 'int 0x80' will do the required stuff and jump to the respective system call.
Also when returning from a system call, we again need to go to user space. For this we need to know the instruction address in the user space to continue the user application. Where is that address stored. Does the 'ret' instruction automatically changes the ring from ring3 to ring0 or where/how this ring changing mechanism takes place?
Then, i read that changing from ring3 to ring0 is not as costly as changing from ring0 to ring3. Why is this so??
Thanks,
Bala
I'm looking for a way to track myself and receive quality data upon which I can write future scripts/programs.
For example, I use Google Reader a lot. I'd like to track the hrefs that garner my clicks. Further, I'd like to drop all of the words of each href into a database where they can be stacked in a hierarchical manner. At the end of the week I want to know that "Ubuntu" garnered 448 clicks and "Cheetos" garnered 2. :)
That's just one example... I'd like this tracking and data-collecting to extend beyond my browser.
I know writing something to do this myself wouldn't be too awfully difficult but if something already exists I'd happily use it.
Thanks in advance.
Primary OS: Ubuntu 10.04
When I run this code via ssh echo wget http://domain.com/send_me_email.php | at 12:54 it run correctly and send me an email at that time.
but if I run a php Like this
exec("echo wget http://domain.com/send_me_email.php | at 12:54");
exec("atq",$arr);
print_r($arr);
result of that code is something like this :
job 63 at 2011-11-27 12:54
,As you can see the job created successfully but I don't receive any Email at that time?!
I test this line in php exec("wget http://domain.com/send_me_email.php"); and it send me an email, it means that I have permission to run exec and wget via php.but what is problem?
I cant understand what is my problem.
Please help me.
thanks