Skip to content
Advertisement

Tag: shell

Find the closest match between two files in unix

As a beginner i’m looking for a solution in shell scripting, I have file1 with content as below lines: And file2 with filenames and their modified timestamp. I’m looking shell script solution where it can tell the closest match in timestamp in the between both files. Like timestamp_x and timestamp_y comes in between timestamp_1 and timestamp_2. Thanks Answer If your

Bash script how to display matched words in custom order

The following is the output of the command ads2 cls create However, I’m trying to extract the value of name and state for each node, save them in a variable and display them in the following order: Till now i, with the help of this so much powerful learning site, could extract the values of name and state by executing

Capturing output from a background subshell in bash?

I’m trying to run multiple subshells in a bash script and capture the stdout result to a variable. When I run the subshell in the background I would expect I can use wait to let the subshell complete and then use the variable the result is assigned to later in the program…. but it doesn’t seem to work. Simple example

Shell Script : MongoDB Dump

I’m creating a shell script to automatically dump the database. I have the current code below. The problem is when I’m opening the zip file it shows a single binary file. Usually, when I dump manually it consists of bson and json files. I don’t know what I’m doing wrong I’m expecting a zip file with bson and json file.

Wait Until Previous Command Completes

I have written a bash script on my MacMini to execute anytime a file has completed downloading. After the file download is complete, the mac mounts my NAS, renames the file, and then copies the file from the mac to the NAS, deletes the file from the mac and then unmounts the NAS. My issue is, sometimes, the NAS takes

How to SSH a curl command

env = GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu) Situation: SystemA=No internet. SystemB=Yes internet. SystemA has a log file. SystemA wants SystemB to send a curl command for him. SystemA$ ssh SystemB curl -X POST -H “Content-type: application/json” -d “$data” $hook = fail SystemB$ curl -X POST -H “Content-type: application/json” -d “$data” $hook = success How do I achieve this without SystemA

Advertisement