On Thu, 18 Sep 2008, Daniel Jarboe wrote:
> Oh, sorry. Some unix versions have an lcase comand. If not, write your
> own:
>
> sed y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
>
> tr A-Z a-z
OK, I tried it with two "sed -e" commands and "sed | tr". The first was a
bit faster (like a few hundredths out of half a second or so) but (to me at
least) the second was way clearer. Here's what I settled on:
#! /bin/sh
while read line ; do
case "z$line" in
z) ;;
z/*) firstcharlc="$(echo "$line" | sed 's@^.*/mp3/\(.\).*$@\1@' | tr A-Z a-z)"
sed "s@^\\(.*/mp3/\\)\\(.*\\)\$@\\1$firstcharlc/\\2@" ;;
*) echo "${line#z}"
esac
done < "$1"
I would like to do it without looping, but I don't see a way.
-- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? [TOFU := text oben, A: Top-posting. followup unten] Q: What is the most annoying thing on usenet? -- Daniel Jensen ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 16:58:38 EDT