I have lots of files in a directory. Example: here 9 represent the hour and change from 1 to 24,the date also change. the hours are represented .1. .2. .3. .4. …. .9. I want to replace this part(only this part) in the file name with .01. .02. .03. .04. …. .09. and do not touch any other number in
Is it possible to transfer a process from a native machine to a virtual machine?
Suppose I have a process foo executing (natively) on my computer. After it has been executing for some time, I want to move this process into a virtual machine – for example, I create a VM using QEMU or Virtualbox. Is it possible to do this? To my understanding, if it’s possible, it’s incred…
How to identify directory paths within multi-line string, replace with references to own file content, in Bash?
Given a bash variable containing the following multi-line string representing *nix paths: I’d like to be able to identify all directories (dir1 & dir2, for example) and to replace these directory path lines with the paths of the files below them. There should be no directory references in the final …
Calculate Median and Average of a Text FIle with Multiple Columns of Data
I have a file with multiple columns of data. I need to calculate the median and average of the two columns. Input: Desired Output: I have tried Which is good for only one column of data. Answer Here I’m assuming you meant to work with columns and calculate two sets of values. Your output format is not r…
MySQL is not accessible from public ip installed on linux
I have debian linux system.I installed MySQL on it.I am not able to access it from public access. I edited /etc/mysql/my.cnf and changed bind-address=127.0.0.1 to my server address and then restarted mysql service. But when I restart mysql service it is showing Warning: World-writable config file ‘/etc/…
debugging long running PHP script
I have php script running as a cron job, extensively using third party code. Script itself has a few thousands LOC. Basically it’s the data import / treatment script. (JSON to MySQL, but it also makes a lot of HTTP calls and some SOAP). Now, performance is downgrading with the time. When testing with a …
C compiler cannot create executables on OpenSUSE
I’ve tried to compile xdebug from sources, but I become this output: There is my config.log. I’ve found possible error: /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: i386 architecture of input file ‘/usr/lib/crt1.o’ is incompatible with i386:x86-64 output /…
How to programmatically prevent linux computer from sleeping or turning on screensaver?
While developing a small cross-platform game on C++, I got stuck with following issue: when players are playing with a USB gamepad without touching a keyboard or mouse, the computer sleeps automatically while they’re playing. In Windows, it can be done easily using SetThreadExecutionState function. In O…
C Web Browser Download File
WebkitGTK+ API Reference What I’m trying to do is run my HTML5 app on Linux that way I and my users can still use my app without relying on an internet connection. My problem is when I go to download say a zip file. The download doesn’t execute because there isn’t an adequate url for the fil…
How to print file/directory details using ls and AWK?
I am trying to print the output as below using the command: or But it does not print anything. O/P should be like, (I am using 0777 or 777 because of find . -type f -perm 0777) Answer you’ve got the right idea, but 777 is the octal representation of permissions, and with this you’re looking at the…