Skip to content

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 assign…

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 figur…

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? Ans…

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…