I got a html file which is as follows(delete some unuseful words). What I want is to edit it without going into the file (sed command for example). I had a dict which is Following the dict, the html file should be Before the replacement it is l1, l3 and l4. After it is l1, l2 and l3. I know
Display ethernet interface and its corresponding IP address from Linux “ip a s”
I am trying to list all the ethernet device names and its assigned IP address available in the RHEL node using the output of ip addr show command I print all the network interfaces names only with the following: I am trying to get the output in the below format by applying more logic and coding in the above a…
Permissions for external drive with different users [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …
Can we store “cd ..” path in a variable in bash file?
I am new to the bash my use case is to store the one previous directory in to a variable. Example: How can we add /local/ to any variable like $PREV? Answer You can use parameter expansion on $PWD which contains the current path: Or, use an external tool like readlink with command substitution:
How to speed-up sed that uses Regex on very large single cell BAM file
I have the following simple script that tries to count the tag encoded with “CB:Z” in SAM/BAM file: Typically it needs to process 40 million lines. That codes takes around 1 hour to finish. This line sed ‘s/.*CB:Z:([ACGT]*).*/1/’ is very time consuming. How can I speed it up? The reaso…
Bash: While-read loop skips the last line of comma-separated text file
I am trying to read some comma-separated data from a text file, parse it and calculate average of column-5. The input is in the following form: I am using the following script for this: The problem with the script is that it does not read / parse the last line of the text. What can I do about that? Also,
How can I create a TCP connection in Python between 2 PCs
So far I have made a VERY basic client/server application that creates a TCP connection. I have a lot of programming experience, just never did this low-level stuff and especially nothing with networks. Note that all the prints are just to help me figuring out what is going on. One of the known issues is that…
How can I find the number of 8 letter words that do not contain the letter “e”, using the grep command?
I want to find the number of 8 letter words that do not contain the letter “e” in a number of text files (*.txt). In the process I ran into two issues: my lack of understanding in quantifiers and how to exclude characters. I’m quite new to the Unix terminal, but this is what I have tried: I …
Rounding of the millisecond part in Linux datetime
So I have the date format like this : 2019-10-19 23:55:42.797 and I want the millisecond part to be round of into the second so the output should look something like this: 2019-10-19 23:55:43 I have tried date -d “2019-10-19 23:55:42.797” “+%Y-%m-%d %H:%M:%S” but it’s giving me o…
Bash script does not wait for user to enter response
I am trying to read a text file (line by line) and take user response in a while loop. However, the script does not wait to take input. Instead, it just prints all the text to screen. The script only prints alternate text lines from the file (Please refer to the image below). Output Answer This worked for me: