Skip to content

How to replace string with bash script and write back the Result

There is a CSV file with some columns, the first column is a 5 digit customer number, the other columns are separated with “;” Here is a example: If the first column is empty than I need to set the last given customer ID. The result should look like: Now I read the file linewise with bash script, …

Number of processors/cores in command line

I am running the following command to get the number of processors/cores in Linux: It works but it does not look elegant. How would you suggest improve it ? Answer nproc is what you are looking for. More here : http://www.cyberciti.biz/faq/linux-get-number-of-cpus-core-command/

nasm assembly linux timer or sleep

I’m trying to find a way to make my code wait for two seconds before proceeding. I’m using nasm for Linux in protected mode, so I can only use int 80h. I found a syscall called “alarm” (27) and another called “pause” (29). However, when I try to use those, the program waits…

How to clear screen on protected mode

I’m using NASM for Linux and I’d like know how, in the protected mode, you can clear the screen. I found a solution using the int10h, but on the protected mode I can only use int80h. Thanks in advance. Answer You can write x1b[2J to the standard output so the terminal get cleared and fix the curso…

PHP: how to start a detached process?

Currently my solution is: and in file.php is there any way I can do this just with exec? Answer No, detaching can’t be done with exec() directly (nor shell_exec() or system(), at least not without changing the command, and using third-party tool which does detach). If you have the pcntl extension instal…

Bash script processing limited number of commands in parallel

I have a bash script that looks like this: But processing each line until the command is finished then moving to the next one is very time consuming, I want to process for instance 20 lines at once then when they’re finished another 20 lines are processed. I thought of wget LINK1 >/dev/null 2>&amp…