Sponsored Content
Full Discussion: More fun with awk
Top Forums Shell Programming and Scripting More fun with awk Post 302319572 by colemar on Monday 25th of May 2009 07:14:47 PM
Old 05-25-2009
More fun with awk

Code:
#!/usr/bin/ksh
ls -l $@ | awk '
/^-/ {
l = 5*log($5)
h = sprintf("%7d %-72s",$5,$8)
print "\x1B[7m" substr(h,1,l) "\x1B[27m" substr(h,l+1)
}
'

ls command with histogram of file sizes.
The histogram scale is logaritmic, to avoid very short bars for smaller files or very long bars for bigger files.

Screenshot:
More fun with awk-clipboard01png
 

7 More Discussions You Might Find Interesting

1. News, Links, Events and Announcements

Fun with FreeBSD

Fun With Automounting on FreeBSD Link: Nice tips for FreeBSD Unix. http://ezine.daemonnews.org/200202/automounting.html (2 Replies)
Discussion started by: killerserv
2 Replies

2. UNIX for Dummies Questions & Answers

fun with tar

ok, i've figured out my problem with distributed, in Solaris GUI if you click on a tar file it will untar it for you, using paramiters I don't know. now, I've got a tar file in / called dnetc-solaris26-x86.tar i want to install it to the "/Veitch" directory how exactly do I use the tar... (17 Replies)
Discussion started by: veitcha
17 Replies

3. UNIX for Advanced & Expert Users

like to have fun in terminal

Hai Friends I have installed FreeBSD in my system... I have installed it to work in text mode don't have the GUI. The default text color is Black background with White Foreground. I want it to be with Black background with Green Foreground. How could i do that. Thanks in advance Collins (4 Replies)
Discussion started by: collins
4 Replies

4. Shell Programming and Scripting

Fun with awk

uggc://ra.jvxvcrqvn.bet/jvxv/EBG13 #!/usr/bin/awk -f BEGIN { for (n=0;n<26;n++) { x=sprintf("%c",n+65); y=sprintf("%c",(n+13)%26+65) r=y; r=tolower(y) } } { b = "" for (n=1; x=substr($0,n,1); n++) b = b ((y=r)?y:x) print b } ... (0 Replies)
Discussion started by: colemar
0 Replies

5. UNIX for Dummies Questions & Answers

fun and easy awk question

I have a file called mytitles.txt containing a list of book titles I have a second file called abfile.txt containing a list of book titles (in the 3rd field) and it has author info and copyright year info as well.. I want to search mytitles.txt for a match in the 3rd field of abfiles.txt, and... (2 Replies)
Discussion started by: glev2005
2 Replies

6. War Stories

Following Cables for Fun!

Hi Folks, I came accross this picture taken a number of years ago now, I just thought I'd share it with you guys. We were in the process of removing equipment from the Data Centre and had followed the cable through to this area, where one of the old patch areas had been. When we lifted the... (2 Replies)
Discussion started by: gull04
2 Replies

7. Shell Programming and Scripting

awk diamond code golf (just for fun!)

Hey guys, This is purely just a little bit of fun with awk. I realize this this isn't that constructive so please remove if need be. Your goal: Create a one line awk script that generates a diamond shape of any size. Both the size of the diamond (measured by its middle line) and the... (7 Replies)
Discussion started by: pilnet101
7 Replies
gifhisto(1)						      General Commands Manual						       gifhisto(1)

NAME
gifhisto - A program to create histogram of number of pixels using each color. The output can be formatted into a GIF histogram file, or as text file - both go to stdout. USAGE
gifhisto [-q] [-t] [-s Width Height] [-n ImageNumber] [-b] [-h] gif-file If no gif-file is given, GifHisto will try to read a GIF file from stdin. MEMORY REQUIRED
Line. OPTIONS
[-q] Quiet mode. Default off on MSDOS, on under UNIX. Controls printout of running scan lines. Use -q- to invert. [-t] Force output to be text file of the following form: (colormap size) lines each containing two integers: number of times color appeared, and color index. Lines are in increasing color index order. This output can be fed directly to a sort program if ordering by color frequency is desired. The colrmap picked is the one to be used for the image to generate histogram for, as defined in GIF format. [-s Width Height] Size of GIF histogram file. The Height of the histogram should be power of 2 dividable by number of colors in colormap. Width sets the resolution (accuracy if you like) of the histogram as the maximum histogram bar is scaled to fit it. [-n ImageNumber] Image number to test. Default is one. [-b] Zeros the background color count. As only linear scale bars are supported and usually the background appears much more often then other colors, deleting the background count will improve the scaling of other colors. [-h] Print one line of command line help, similar to Usage above. AUTHOR
Gershon Elber Man page created by T.Gridel <tgridel@free.fr>, originally written by Eric S. Raymond <esr@thyrsus.com> giflib-tools gifhisto(1)
All times are GMT -4. The time now is 03:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy