Linux/Unix

You are currently browsing articles tagged Linux/Unix.

~ $ cat example.txt
first line
second line
third line
another line

~ $ sed -n ‘/second/{n;p;}’ < example.txt
third line

~ $ sed -n ‘/second/{n;p;n;p;}’ < example.txt
third line
another line

Tags: ,

On Linux or Unix systems perform recursively a command on items might contain white space, quote marks, or backslashes can be a problem when using find | xargs combination.

To solve this you may use:

find -type d -print0 | xargs -0 <command>
find -type f -print0 | xargs -0 <command>

For example to fix recursively permission:

find -type d -print0 | xargs -0 chmod 755
find -type f -print0 | xargs -0 chmod 644

Tags: , ,