Tags » Xargs

Parallelisation of data processing pipelines in shell using 'xargs' (and parallel)

I like scripting with shell a lot since it is simple, available almost everywhere and is fast and efficient. Recently while reading this I came across a way to make data processing several times faster using ‘xargs’ command. 461 more words

Programming

automate killing processes older than N days

It saves a lot of efforts once I scheduled such script in crontab, to kill ftp program older than 2 days ago.

find /proc -maxdepth 1 -user oracle -type d -mtime +2 -exec basename {} \; 2>/dev/null | xargs ps|grep ftp | awk '{ print $1 }' |xargs kill
Linux

Searching large source trees in an efficient way on Linux

TL;DR

Here is the alias:

alias search 'find \!:1 -noleaf -type f -not -path "*/boost/*" -not -path "*/extensions/*" -print0 | xargs -0 -n 100 -P 8 grep -I --color -H -n \!:2*'
… 589 more words
Linux

Ubuntu: convert an MKV to AVI

Meisha, just like me, is a fan of Tom and Jerry. I have a good collection of Tom and Jerry videos. The only problem was all those videos are in mkv format and she had to open her laptop to watch those videos every time. 87 more words

Bash

Why `xargs head` print filename?

Given two files,
a.txt content is: A1, b.txt content is: B1

While execute printf "a.txt\nb.txt" | xargs head -1,

I hope it output… 82 more words

Linux

find command examples

Problem:
I needed to clean up after running tests

Solution:
Using find

$ tree
.
├── bin
│   └── hello
├── hello
│   ├── hello.py
│   └── __init__.py
├── requirements.txt
├── setup.py
└── tests
    ├── __init__.py
    └── test_hello.py

3 directories, 7 files
… 248 more words
Bash