I have a log file consisting of a list of epoch 19-digit timestamps, for example I would like to iterate through this list, and compare the previous timestamp to the current timestamp in the list and echo a message if x duration of inactivity as occurred, ex: What would be the most efficient method to iterate through the list such
Tag: bash
Run different bash scripts, started by one bash startscript, in different terminal tabs
I like to run more than one bash script, each in own terminal tab. Now what did i found: The follow run two scripts inside one terminal: start.sh task_1.sh task_2.sh The follow are able to open a new tab on terminal: Now i have found the follow solution: Thats working fine, a give a error message like, “replace the old
Bash – How can i send notification once if a service is not running?
I am running the following script to check if my docker services are running. If a service isn’t running, the script sent a message to my rocketchat app via webhook like this: It works, but if a docker service is not running, i receive the message every minute again, because the script is running every minute via cronjob. So how
I am trying to use awk to extract a portion of each line in my file
I have a large file of user agent strings, and I want to extract one particular section of each request. For input: I am trying to get output: from after /product/ in the sample above. I’m trying to use Awk, but I can’t figure out how to get the regex expression that’s required for this. I’m sure it’s simpler than
Renaming sub-directories recursively to a new pattern in bash
I want to rename sub-directories to my new pattern but some results may be dangerous in my own script: For example if I use /tmp/etc as input argument I would have the nasty results in the first iteration: So in next iteration there will not be /tmp/etc to work at. The second problem in my script is when I use
How to add number assigned as array
I have that script that is supposed to read data from two txt files and add them. For that matter I have used array. I can read the data but there is a problem with the addition. Instead of ${dataAll[$i]}= $( ${data1[$i]}+${data2[$i]} ), I have also used ‘expr ${data1[$i]}+${data2[$i]}’ The analysisSBM105.out file has the following But still it doesn’t work.
Why print empty path in shell script?
samuel@:~/…/linux$ ./test.sh find . -type f -name “*” samuel@:~/…/linux$ How do I fix this to get find . -type f -name “*” ‘s result? Answer I suggest to use an array:
(Linux-Bash) Create an account for each user and add the user to its group from a text 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 2 years ago. Improve this question I have a username.txt which contains their username and specific group. As of right now i’m trying to create a
Search for log having value greater than certain time
Below is the sample log: Below is the desired output: When I use awk if it is exact time it will display the output otherwise it not displaying the output. Below is the code: Not displaying output: Displaying output: Besides that I got to find a solution. Below works but not as expected. Displaying output as expected: Displaying output. Expecting
Adding prefix of directory name to all rows of a column in Bash
I want to add a prefix of a folder’s name to all rows of a csv file. The aim is to combine this awk command with the find command so I can automate it and apply it to all directories and subdirectories within a folder. Trying to output the result to a new csv file _prefix.csv to be safe. What