Skip to main content

Find files NOT of type

find . -type f -not -iname "*.jpg" -not -iname "*.jpeg" -not -iname "*.gif" -not -iname "*.png" -not -iname "*.pdf"

Useful!

Split files on lines

Split the file into multiple files at every 3rd line . i.e, First 3 lines into F1, next 3 lines into F2 and so on:

$ awk 'NR%3==1{x="F"++i;}{print > x}' filename

Count PDF pages with php

function getNumPagesInPDF($PDFPath = NULL)
 {
 $stream = fopen($PDFPath, "r");
 $PDFContent = fread ($stream, filesize($PDFPath));

ORDER BY Flexible

Soooo nice:

SELECT * FROM `menu` WHERE weight != 0 ORDER BY (CASE type WHEN 118 THEN 2 WHEN 54 THEN 4 END) DESC

SCP syntax

Useful to copy directories from one server to another:

cd into the dir you want to have your data

scp -prq username@127.0.0.1:/var/www/comefromdir/ .

Subscribe to