Skip to content

Tag: bash

How to know when dd has finished

I have a issue with the dd comand. I use it in a while like this: And it works like charm, the only problem is that once the file is read completely, it doesnt stop the while, it stays there stalled. How could I make the while to stop once the dd read all the file? BTW: Note my machine

Docker $(pwd) and bash aliases

I’m running Docker CE in Ubuntu 16.04. I’ve created a Docker image for the polymer-cli. The idea is to be able to run polymer commands from inside disposable docker containers using bash aliases that mount the current directory, run the command and then destroy the container, like this: This works…

How to use sed to delete lines not containing pattern

I have a file as below: I need to delete all lines except the first line, which means that lines should not be deleted if it contains Thumb[any characters except /].jpg. I try to use sed to do this but I don’t know how to write the regex. I’ve tried like this: sed -i -e ‘.*Thumb^(/).jpg!d&#8…

How to find a postion of the lowest value in the file?

How to output position of a line with the lowest value inside? I have a file with data like below: I need to find a lowest value from the last column and return its position Answer You can use this command in order to get only the line number where the value is shown(if the value appears more than one

Bash parse output in route command

I am writing a bash script to register the remote hosts in a wireless network. I am getting the remote IPs, but I need help to parse the output. Here’s my output: I need to get these IPs and insert into a command like … <remote_ip_1> … How can it be done? I couldn’t find this cas…

Schedule a function that belongs to an R package

I’m trying to build an R package whose goal is to run a series of analyses by taking input data and writing output data to an external database (PostgreSQL). Specifically, I need a set of operations to be scheduled to run on a daily basis. Therefore, I have written some bash scripts with R code (using t…