I have file format like this (publishfile.txt) I just want to extract the name OMEGA****, sample, sample(1) How can I do that I have used basename in my code but it doesn’t work in for loop. Here is my sample code But this code also doesn’t wor when used outside for loop Answer This simply says th…
Tag: linux
Filling empty spaces in a CSV file
I have a CSV file where some columns are empty such as How do I replace all the empty columns with the word “empty”. I have tried using awk(which is a command I am learning to use). I want to have I tried to replace just the 3rd column to see if I was on the right track this left
Any way to ensure that no more than x HTTP requests are sent to a certain site in Linux?
I am using Docker, base image is alpine. I have an application that sends HTTP GETs to a certain site but I have a limitation, after 50 requests I have to pay some amount per request and I want to avoid that. I will also impose some sort of hard stop from the application code but I wanted to know
definition of linux perf cache-misses event?
I am trying to use linux perf to profile cache performance. perf list shows there is a cache-misses event. However, what’s the definition of this “cache-misses” event? Is it one of L1D/L1i cache, L2 cache or L3 cache? Thanks! Answer The cache-misses event corresponds to the misses in the las…
TensorFlow MirroredStrategy() not working for multi-gpu training
I am trying to implement TensorFlows MirroredStrategy() to run a 3DUNet on 2 Nvidia Titan RTX graphics cards. The code is verified to work for 1 GPU. My OS is Red Hat Enterprise Linux 8 (RHEL8). The error comes at model.fit(). I have installed the appropriate NCCL Nvidia Drivers and verified that I can parse …
PHP-FPM can’t access files in home directory — stat EACCES — “File not found”
I recently updated PHP-FPM to version 7.4.2 (on Arch Linux) and noticed it stopped working (everything was fine before) by responding “File not found” to all clients. The process, and also nginx, run under my personal user account (kevin UID 1000). Nginx serves static content from my home director…
Why is there a “gap” beween the variables that I initiated in the stack?
I’m trying to play around with a buffer overflow. When the program counter gets to if(modified != 0), the base pointer is 0x00007fffffffdfe0. Right below the base pointer, I see 4 bytes that contains integer 0 which makes sense. However, the buffer is not right below the int modified. It looks like 4 by…
Copy a folder contents and save the file with diff name Unix
I have a bunch of .txt files in a directory. I m looking for a command to copy all .txt files and save it with <filename>_2.txt. Eg: abc.txt -> abc_2.txt (After copy) Thanks in tons in advance Answer EDIT: As per OP’s extension request adding following code now. Try following. Above will print …
GCP Startup-Script for setting DNS entries RHEL-7
I’m trying to expand my Google Cloud Platform startup-script so that it sets DNS entries. But every time I include these two lines of code the script does not get executed and fails. When I login to the Virtual Machine the commands work fine. The Error message I get is the following: Answer Please inclu…
strstr() and exit(0) trouble in C
so I’m working on a simulated linux shell using C (homework), and I have it exiting the program if the user just simply types in “quit”. However, if they throw “exit” somewhere inside a command… “cat file ; exit” I need it to execute the command like normal, the…