How to process a multiline string line at a time

July 27th, 2016

foreach (split(/\n/, $str)) {
  if (/START/../END/) {
    next if /START/ || /END/;
    print;
  }
}

UNIX find for finding file names NOT ending in specific extensions

July 27th, 2016

without ( and the need to escape it:

find . -not -name "*.exe" -not -name "*.dll"

and to also exclude the listing of directories

find . -not -name "*.exe" -not -name "*.dll" -not -type d

or in positive logic ;-)

find . -not -name "*.exe" -not -name "*.dll" -type f 

HP-UX Porting and Archive Centre

July 27th, 2016

This is the HP-UX Porting and Archive Center - pre-built packages for HP-UX 11i

Exclude directory from find . command

July 27th, 2016

Single Directory:

find . -path ./misc -prune -o -name '*.txt' -print

Multiple Directories:

find . -type d \( -path dir1 -o -path dir2 -o -path dir3 \) -prune -o -print

Find directories that DON'T contain a file

July 27th, 2016

Exact file:

find base_dir -mindepth 2 -maxdepth 2 -type d '!' -exec test -e "{}/cover.jpg" ';' -print

Multiple Extensions:

find base_dir -mindepth 2 -maxdepth 2 -type d '!' -exec sh -c 'ls -1 "{}"|egrep -i -q "^cover\.(jpg|png)$"' ';' -print