Fun with awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Fun with awk
# 1  
Old 05-25-2009
Fun with awk

uggc://ra.jvxvcrqvn.bet/jvxv/EBG13

Code:
#!/usr/bin/awk -f

BEGIN {
for (n=0;n<26;n++) {
  x=sprintf("%c",n+65); y=sprintf("%c",(n+13)%26+65)
  r[x]=y; r[tolower(x)]=tolower(y)
  }
}

{
b = ""
for (n=1; x=substr($0,n,1); n++) b = b ((y=r[x])?y:x)
print b
}

uggc://jjj.zvenaqn.bet/~wxbzvarx/ebg13/njx/ebg13.njx

Last edited by colemar; 05-25-2009 at 08:14 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. Shell Programming and Scripting

More fun with awk

#!/usr/bin/ksh ls -l $@ | awk ' /^-/ { l = 5*log($5) h = sprintf("%7d %-72s",$5,$8) print "\x1B 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: (4 Replies)
Discussion started by: colemar
4 Replies

5. 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

6. 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

7. 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
Login or Register to Ask a Question
bup-margin(1)						      General Commands Manual						     bup-margin(1)

NAME
bup-margin - figure out your deduplication safety margin SYNOPSIS
bup margin [options...] DESCRIPTION
bup margin iterates through all objects in your bup repository, calculating the largest number of prefix bits shared between any two entries. This number, n, identifies the longest subset of SHA-1 you could use and still encounter a collision between your object ids. For example, one system that was tested had a collection of 11 million objects (70 GB), and bup margin returned 45. That means a 46-bit hash would be sufficient to avoid all collisions among that set of objects; each object in that repository could be uniquely identified by its first 46 bits. The number of bits needed seems to increase by about 1 or 2 for every doubling of the number of objects. Since SHA-1 hashes have 160 bits, that leaves 115 bits of margin. Of course, because SHA-1 hashes are essentially random, it's theoretically possible to use many more bits with far fewer objects. If you're paranoid about the possibility of SHA-1 collisions, you can monitor your repository by running bup margin occasionally to see if you're getting dangerously close to 160 bits. OPTIONS
--predict Guess the offset into each index file where a particular object will appear, and report the maximum deviation of the correct answer from the guess. This is potentially useful for tuning an interpolation search algorithm. --ignore-midx don't use .midx files, use only .idx files. This is only really useful when used with --predict. EXAMPLE
$ bup margin Reading indexes: 100.00% (1612581/1612581), done. 40 40 matching prefix bits 1.94 bits per doubling 120 bits (61.86 doublings) remaining 4.19338e+18 times larger is possible Everyone on earth could have 625878182 data sets like yours, all in one repository, and we would expect 1 object collision. $ bup margin --predict PackIdxList: using 1 index. Reading indexes: 100.00% (1612581/1612581), done. 915 of 1612581 (0.057%) SEE ALSO
bup-midx(1), bup-save(1) BUP
Part of the bup(1) suite. AUTHORS
Avery Pennarun <apenwarr@gmail.com>. Bup unknown- bup-margin(1)