My test file has text like: I am trying to match all single lines ending with semicolon (;) and having text “dummy(“. Then I need to extract the string present in the double quotes inside dummy. I have come up with the following command, but it matches only the first and third statement. With -o flag I expected to extract
Tag: linux
Merge sed commands into a script
I need to write these two sed commands in a single script. I selects lines in range from 10 to 20 and prints them in a reverse order Could anybody please help me with this? Answer This seems to be working
Difference between “${param[0]}” and ${1} in bash
I’m looking at some old scripts and I found some parameter assignment that I have not seen before. A while loop reads from a text file and passes the values to a function. The items in the text file look like this: the first stage of the function then looks like this: I have not seen this sort of assignment
JQ – Deep child replace through wildcard search, but check parent presence with merge to the original JSON
This is a kind of extension to my previous question JQ – Deep child value replace through wildcard search and merge to the original JSON I want to check the presence of a particular key in some parents before replacing the child. Loosely, translated to CSS selector, I want something like * > fixedKeyCheckPresence > * > fixedKeyCheckValue Input: Expected
ROS Noetic setup: /etc/ros/noetic/setup.bash not created
I am attempting to set up ROS noetic for Linux Mint 20. However, “sudo apt search ros-noetic” does not return anything. I ran the most similar package I could find, “ros-desktop-full,” and followed the rest of the wiki’s installation instructions from there, but can’t figure out how to finish environment setup, since /etc/ros/noetic/setup.bash was not created. sudo find / -name
How to format unix time (sec+usec+nsec) string?
I have this function which works just fine. It gives me current system time the way I need: Now I need to also be able to print timestamps I receive from 3rd party lib in 2-3 variables – sec, usec, nsec (optional). Can I somehow construct timespec from these values and reuse the code I already have? Answer You don’t
How to populate json file with data from bash variable
I am writing a small bash script and I am stuck. I have a text file with some information and I stored the contents of that file in a bash variable. My tools.txt file looks like this: And so on. What I want is to dynamically create a JSON file named tools.json and to populate that file with the content
how to extract part of log file bash [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 11 months ago. The community reviewed whether to reopen this question 10 months ago and left it closed: Original close reason(s) were not resolved Improve this question I have a log
tinyproxy: How to manually install the most recent version 1.11.0 on Ubuntu? [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 Exchange site, you can leave a comment to explain where the question
How to put a value after certain pattern in a Linux file
I run a script which stores a value in a variable like this: Now I have a file called env-list which has an entry like this: I want to redirect the output of first command to paste after = sign in env-list file, so that my env-file holds the secret value from first command: secret=value. I am struggling a lot