I am writing a program on a hotel reservation system and have declared a struct Room as follows: I use a variable read from an input file to create an array of n structs which is all the rooms in the hotel. I then create the shared memory space and attach it, but when I try to access it after,
Tag: unix
How to find sequence of characters matching an identifier in Linux/Unix?
I have a fasta file called mytext.fasta. mytext.fasta When I do grep -A1 ‘SS1G_01082’ mytext.fasta, I get: Instead I want to get: If you notice, every sequence starts with > in this file, so I want to get the full length of sequence when I do grep. How can I get this done? Answer It is easier with gnu awk
how to remove “^@” from text files in unix?
I am trying to remove “^@” from multiple text files using Unix platform. I have already found this solution, but it does not work for my case. I also used sed -i -e ‘s/^@//g’ testfile.txt and dos2unix testfile.txt. sample data are put here. Any suggestion would be appreciated. Answer The ^@ that you’re seeing isn’t a literal string. It’s an
Unix – Replace column value inside while loop
I have comma separated (sometimes tab) text file as below: parameters.txt: with below code I try to loop through the file and do something I wanted to update the last column of the file to N if the above operation is successful, however below approaches are not working for me: sed ‘s/$f5/N/’ ‘$5==”Y”,$5=N;{print}’ $(echo “$line” | awk ‘$5=N’) Update: Few
IF statement for different lines [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago. Improve this question Question is simple, but I can’t find a fast and elegant way to solve. I want to decide next: if block size of files is
Search and Replace ( multiple lines )
Hello StackOverflow Community! I’m working on a bash script to change in Dynamic text file, I want to replace multiple lines with one line. Ex: This example, I want to replace THIS With KKKKK Before script After script I found a script to replace using ( sed ) but it doesn’t replace multiple lines. NOTE: I’m a beginner at scripting
Replace string pattern with a string in linux file [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago. Improve this question I am a newbie to Linux. Need to replace With using sed or some alternative. Answer Command that given desired
Using sed to replace uppercase to lowercase, space to underscore then create a xml file with results
Apologies ahead of time if this is stated wrongly as I have searched but could not find how to sed + echo while using while loop to read a file. I have a before.txt file that looks like this: and I need it to look like this: This is what I have so far … But it fails How do
why my unix domain socket can’t work
there are two simple program to demo the unix domain DGRAM socket. and the following is the result: it seems like nothing wrong here. but, I get nothing from the server. I don’t know why it can’t run as I expect. Answer You should be sending to /var/run/lsvr.sock not to /var/run/lcli.sock. Also you don’t have to bind in client so
How can i initialize and then iterate an array in linux makefile?
I need to create an array with directories and then inereate it, creating one more array in each step which will include all files found via ‘find’ command for each derictory and also iterate this array. I was trying to do something like this: but it does not work. Even this gets error: gets error: Answer This is because make