I have to search a file for lines with some specific words and edit these lines as follows. The other lines should remain the same. For example: to be modified to: Can any one please help how to use AWK to achieve this. Regards Answer awk solution: Explanation: When brz or jp matches, save last field in last,…
Tag: linux
How to save a .txt file from a virtual server to my real machine?
My problem is: My Debian9 which is run on a virtual box is not working just wihtout internet mode. CTRL+C – CTRL+V commend is not working, i don’t know why. How can I save my txt file to my real PC? Answer So, if you want transferring files from a Linux VM to your local machine. I recommend take r…
how to linux command find many types
my command but this command return error find: Arguments to -type should contain only one letter i want only file or directory search how to many types in linux command find Answer You need spaces around the parentheses, since they have to be separate arguments to the find command. The way you wrote it, it th…
How to proceed with Linux source code customization?
I am a non CS/IT student, but having knowledge of C, Java, DS and Algorithms. Now-a-days I am focusing on operating system and had gained some of its concepts. But I want some practical knowledge of it. Merely writing algo code in java/c has no fun in doing. I have gone through many articles where they mentio…
How does an odd number solve a split brain in a distributed system?
Distributed system suggest using odd number of Master nodes, like 3 Master nodes or 5 Master nodes to avoid split brain problem. But how does it solve the problem? If there’s 2 nodes ( A and B ), 1 Moderator, if A and B tell the Moderator that “I’m Master”, then brain split occurs. The…
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow
I am running the following code on Raspberry Pi with pi camera, I have the broadcom drivers for it and all, but I am getting an error. Perhaps something to do with the dimensions of the video feed, but I do not know how to set it on Linux. Code: Error: Answer Provide an id to VideoCapture. Also check the
C Program that makes a copy of a file using standard I/O and system calls
I am trying to write a C program which uses standard I/O and System calls to perform copying of contents of one file to another file. So far, I have done this : When I run the program like this : Assuming that one.txt is well defined, what I want is to create a new file called two.txt and copy
How to print the last line of each ID?
I have a list of IDs (exon) each with multiple suffixes and I want to get the last line of each ID Input: Desired output: Answer
get stuck in mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
When I use mysqld_safe to start my MySQL in CentOS7: It get stuck in the mysqld_safe Starting mysqld daemon. I find the SO, do not find this post, and some similar, but is not stuck, they report error directly. MySQL version is 5.7.19 My requirement is change the user root’s password. Answer At last, I …
Can I use 1G superpages to back shared mmaps?
So far when I’ve tried using a file in /mnt/hugepages1G/ as the backing I get segfaults. It works fine if I use 2M superpages in /mnt/hugepages/ I think I read somewhere that I now can’t find that Linux only supports 2M pages for Shared memory? But I can’t swear to it. Can’t find it in…