fittheseventh.net


UNIX

Wrapping Lines in vim and vi

gggqG for the whole file. gql for the cuttent line.

Escaping Spaces et al.

This script takes standard input and escapes spaces and other characters using prinf's %q. Especially useful for find as in find ./ | escape


    #!/bin/bash
    IFS=$'\n'

    while read line;
    do
    printf "%q\n" $line
    done
  

Fixing ldapsearch Wrapped Lines for Proper Scripting

| perl -p00e 's/\r?\n //g'

I have found this infinitely useful piping ldapsearch queries into to be further processed down the pipeline.

Elements