temporaneità
English scratches and Italian notes written by Carlo Perassi
  • About
    • Borges
  • Curriculum Vitae
  • Contact
Browse: Home / AWK

AWK

It doesn’t fit all jobs

By Carlo on 2008-03-03

Reading the referers of this website, I found that someone reached it querying a search engine for using AWK to find zero length files AWK is a great tool but IMHO that is not its job. I would have used a simple find -size 0b

Posted in English | Tagged AWK, Bash, free software | Leave a response

AWK, the summer :)

By Carlo on 2007-11-30

Sorry, I’m addicted to puns. :) This is a note for me, you and Michele: do you want to get the sum of a set of integers? Try this one-liner: awk ‘{TOT += $0} END {print TOT}’ your_filename Use $0 if your_filename has lines with one integer each, of course you can use $another_integer if [...]

Posted in English | Tagged AWK, free software | 1 Response

Exporting changed only files with Subversion

By Carlo on 2007-08-30

Reading the referers of this website, I found that someone reached it querying a search engine for subversion or svn export only changed files This one-liner (that can be easily turned into a subversion hook) could do the task for i in `svn log -r HEAD -v | grep “^ [MA]” | awk ‘{print $2}’`; [...]

Posted in English | Tagged AWK, Bash, free software, Subversion | 2 Responses

A Bash-becue recipe :)

By Carlo on 2007-08-14

Reading the referers of this website, I found that someone reached it querying a search engine for bash scripting validate file extension I suppose they were looking for a script that, for example, when it finds a perl file, it is able to recognise it as such even if its extension is not pl. Well, [...]

Posted in English | Tagged AWK, Bash, free software | 2 Responses

Using AWK to remove file extensions

By Carlo on 2007-02-16

Reading the referers of this website, I found that someone reached it querying a search engine for awk remove file extension Well, it’s definitely easy to achieve it if your files have just a “.” in their names. You can use this one-liner that works inverting the problem :) # substitute jpg with the extension [...]

Posted in English | Tagged AWK, Bash, trivial hacks | 10 Responses

Finding file extensions with AWK

By Carlo on 2007-01-30

This one-liner helps in finding the file extensions of a given Subversion working copy: find path_to_repos -type f | grep -v “/.svn/” | awk -F “/” ‘{print $NF}’ | awk -F “.” ‘{if (NF > 1) {print $NF}}’ | sort | uniq Its usage outside of Subversion is even more trivial.

Posted in English | Tagged AWK, Bash, Subversion, trivial hacks | Leave a response

Search

It passes

it passes

My posts, unless otherwise expressly stated, are licensed under a Creative Commons Attribution-Share Alike 2.5 Italy License.

Copyright © 2006 - 2012 by Carlo Perassi. Powered by WordPress and Hybrid.