Skip to content

Linux piping find and md5sum not sending output

Trying to loop every file, do some cutting, extract the first 4 characters of the MD5. Here’s what I got so far: Problem is, I don’t see any more output at this point. How can I send output to md5sum and continue sending the result? Answer md5sum reads everything from stdin till end of file (eof) …

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…

Measuring execution time – in program code or in shell?

I have a program and I want to measure its execution (wallclock) time for different input sizes. In some other similar questions I read that using clock_gettime in the source code wouldn’t be reliable because of the CPUs branch predictor, register renaming, speculative execution, out-of-order execution …

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…