| Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
I was trying to do the following to report on the most used commands (for
each user found in /home).
find /home -maxdepth 2 -name '.bash_history' -exec bash -c 'echo -e
"\n$1\n"; cat "$1" | awk '{ print $1 }' | sort | uniq -c | sort -rn | head
' _ '{}' \;
But I couldn't figure out how to get awk quoting to work inside the bash -c
string literal. I looked it up, so now I know how to do it. I know it's
been discussed on this list before. I just throw it out there as a
refresher :-)
Answer: Use these four characters '\'' to represent a single quote (inside
a single quoted string)
(I think you can also use the octal representation of a quote character,
but that's not as easy to remember.)
Greg Rundlett