I have 70 input files, file names are as like slurm-22801576.out, slurm-22801573.out, slurm-26801571.out, and so on. I want to extract all desired strings to one file. So I did the following but I was able to do so for one file only. How to do that on multiple files? But my output file has only one row Inside each input
Tag: linux
Recode value in the column in unix with awk or sed
In the following file, The values of 6th column for the rows who have values other than 1 or 2 in sixth column should be replaced with -9. How can I do it? old.fam new.fam should be Edit: I used cat old.fam | awk ‘{ if ($6==1 || $6==2) {print $1 ” ” $2 ” ” $3 ” ” $4
How to apply regex to specific column in awk
This will colorize the output of ls -lhAXF How to apply the color to specific type of item using regex, for example i want the folder to be green, the .config folder red, the regular file blue or something like that. folder – match $9 column containing ‘/’ in the end of word hidden folder – match $9 column containing
Can’t compile sample bpf program, bpf/bpf.h is missing
I’m trying to compile the sample bpf program in Linux source code. So I downloaded the current kernel source code and entered samples/bpf folder Then I tried to compile a sample program with gcc: And I’m unable to find bpf/bpf.h with apt-file What was wrong? Answer The Linux eBPF samples come with a rather long Makefile. It handles a lot
How does npm verify packages and how to verify npm/node installation packages between machines?
Where in the npm code does it verify the packages against a checksum? Also is it possible to verify one machine’s installation of node and packages vs another machine? As in, is it possible to generate a bunch of checksums for a machine to compare with whatever’s in the registry, and on a separate machine. In npm, it seems to
How to get Linux file permissions in .NET 5 / .NET 6 without Mono.Posix with p/invoke?
I recently found, that I can make Linux system calls from .NET relatively easy. For example, to see if I need sudo I just make a signature like this: Neat. So much easier and faster than everything else, right? This is the simplest possible system call, other use strings and structures. After some digging in the documentation and testing for
In Linux, are there any functions similar to CreateConsoleScreenBuffer/ReadConsoleOutput to read the terminal contents?
That is, how to create a new screen buffer and read/ write buffer contents in Linux? The screen buffer I am talking about refers to the content displayed to the user. Or the entire screen. I don’t want to use ncurses. I found terminfo, but I want a function instead of an command. Perhaps ioctl can read the buffer, but
Subprocess – Too many open Files in subprocess
On my system(using python3.6.9) I got the Too many open Files Error. I got the error while executing a subprocess in python. Traceback: I tried to look it up but permanently setting the ulimit didn’t work. I even build a function, that sets the ulimit before executing a subprocess. Answer I didn’t find the right solution on the Internet. The
Key error while running a Python program with getitem
The code below creates this error when ran on Amazon Linux 2. The intent is to have the python program respond to user input from a discord server. I know just enough to get me here about python. Any help is appreciated. They server is running an updated version of Amazon Linux 2. Answer You are trying to read from
converting 4 digit year to 2 digit in shell script
I have file as: Here the 1st column represents dates as YYYYMMDDHH I would like to write the dates as YYMMDDHH. So the desire output is: My script: It is printing Any help please. Thank you. Answer Please don’t kill me for this simple answer, but what about this: You simply cut the first two digits by showing character 3