Posts in 'general'

Luca Lanziani

Read file in chunks in bash

How to read a file in chunks. You can optionally specify the starting point and the chunk size.

#!/bin/bash

function read_file_in_chunks { # FILENAME [START_FROM_LINE] [CHUNK_SIZE]
   FILENAME="$1" && shift
   START_FROM_LINE="$1" && shift || START_FROM_LINE=1
   CHUNK_SIZE="$1" && shift || CHUNK_SIZE=10

   FILE_LINES=$(wc -l < "${FILENAME}")
   FILE_LINE=${START_FROM_LINE}

   while [[ ${FILE_LINE} -le ${FILE_LINES} ]]; do
       CHUNK ...

Luca Lanziani

Post from mobile

Just for fun.

printf("Hello Franco");
printf("Hello Federico");
printf("Hello Enrico");

Luca Lanziani

Gmail signature

For a while I had no signature on my email then I started to add a simple "Luca Lanziani" and now I have the following format:

--

Luca Lanziani - Software Engineer
e-mail : [email protected]
site : lanziani.com
skype : luca.lanziani

It is a simple html table with some inline ...