I have this expect script that is supposed to read a gpg encrypted password, and use it to call a remote script via ssh (there are many reasons why I need to do it like that). Now, my problem is that whenever I run this script, the ssh connection is correctly set up, but it fails in writing the output
Tag: bash
How to use grep in shell with -e option set
In bash -e option stops executing after an error and grep commands returns a non-zero status in case it does not find for the pattern it is looking for. I want to use grep inside an if statement, something like If i use $? to get the statement of last command, then the execution stops after last command as gr…
AWK – Show lines where column contains a specific string
I have a document (.txt) composed like that. And I want to show some information by column. For example, I have some different information in “info3” shield, I want to see only the lines who are composed by “test” in “info3” column. I think I have to use sort but I’m …
Executing HTTP POST using curl in bash with environment variables as data
I am trying to make a HTTP POST to a server using curl but I can’t seem to make it work. The server has the Content-Type set to application/json so I need to send a json object to the server. My object looks something like this If I try to use the following command it works But if I store
how do i execute grep chain command in background using bash script
I have a data for 24 hours logs per each day. the data is huge to grep the required string, taking 3 hours to search the string in all 24 hours dir. to reducing the consuming time I’ve decided to separate the 24 hours in to three parts and wanted to execute each part parallely in background using & …
Replacing string with variable with Groovy and SED command
I am trying to replace an entire description string contained in an XML file. I would like to replace that string with a variable. I am using a SED command within a Groovy script. I have the following code. I am expecting the string “foo” to replace the description text but it doesn’t. Inste…
Execute program with different parameters and storing results in txt file
I am trying to execute a program (let’s say myApp) in the ubuntu shell. Normally myApp is called like this: myApp /path/to/file1 /path/tofile2 the output is a matrix which will be printed on the standard output. What i want to do is to execute myApp for all files in a directory and save the output in a …
Bash – Retrieve ID From A String (xinput) Received From A Pipe
When I run the following command it returns me the information of my current mouse:- What command should I execute (maybe along with some regex) that I can get an output 13 (in current case). Something like this:- Answer Or even shorter :
Find usage % of a directory in the disk [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 …
How to grep string and show previous word in a Linux file
i have a file with a lot of IPs and each IP have an ID, like this: Below this Ips and after these Ips the file have more information, its a output to an API call.. I need, grep a IP and then the command shows the id, just the number. Like this: EDIT: More information, the ip will be