web analytics

Unix: rename files to lowercase

It’s very simple to rename the files to lowercase/uppercase using awk:


ls -1rt | awk ‘{ printf("mv %s %s\n", $0, tolower($0)) | "sh" } END { close("sh") }’


ls -1rt | awk ‘{ printf("mv %s %s\n", $0, toupper($0)) | "sh" } END { close("sh") }’

Using pattern lists in Unix

Here is the small reminder about the syntax of the “case” command and the usage of the pattern lists.

#!/bin/ksh print -n "Please enter the line: " read line case "$line" in  ?(dog|cat)  ) print "zero or one occurrence of any pattern" ;;  *(low|high) ) print "zero or more occurrences of any pattern" ;;  @(duncan|methos) […]