Example 1: Comparing Two Files

fb h File1 File2

      8514:  5 FD
     41145: D1  0
     41146:  A 6E
    598002: 9A B3
    598818:  EOF  :1902318

The output reports the offsets where the two files differ and their differences in hexidecimal. Since the files differ in length, the last line of the output reports their respective file lengths.

For Linux/UNIX users: "fb o File1 File2" is similar to "cmp -l File1 File2"; however, be aware that cmp starts counting bytes from 1 rather than 0 as fb and od do.


Example 2: Searching with grep

fb -blnks -p 1 -i 6 File | grep 1100000011

will find occurances of the bit pattern 1100000011. Explanation: (1) "-b" will (by default) show 8 bytes per row. (2) The bit pattern 1100000011 could span 3 bytes. (3) Thus the increment must be 6 ("-i 6") in order not to miss cases where the 3 bytes start in one row but end in the next row.


Example 3: Removing Carriage Returns from DOS Files

(1) fb -lans File > File.hex

(2) Edit File.hex so as to remove all occurances of " 0D".

(3) fb t h File.hex File

For Linux/UNIX users: fb will also translate dumps made with od since when fb reads hexidecimal numbers it is not sensitive to case. "fb -lans File" is similar to "od -An -v -tx1 File"; "fb -lands File" is similar to "od -An -v -td1 File"; and "fb -loans File" is similar to "od -An -v -to1 File". All of these outputs can be translated by fb; but, in addition, fb can translate a file of the format produced by "fb -blans File", which is a dump in binary numbers. And fb can translate a file wherein the numbers are not delimited (or there is a mixure of some delimited and some not). Adding the "-k" option to any of the fb examples above will result in the dump having no spaces between numbers.


Example 4: Creating/Editing a Bit Map File Using Translate

The following are the contents of the description file net.fbb and the Windows bit-map file net.bmp created when fb translates net.fbb. To do this fb is invoked like so:

fb t b net.fbb net.bmp

The file net.fbb:

| net.fbb
| Author: John Swaby
|   Date: 17 October 1998

| This file should be translated by fb t b(inary)

| Header information:
 | Type of file
  01000010 01001101 | BM (Bit Map)

 | Size of file: 190
 |     190 +  256*0 + 65535*0 + 16777200*0
  10111110 00000000  00000000     00000000

  00000000 00000000 00000000 00000000

 | Length of header: 62
  00111110 00000000 00000000 00000000

  00101000 00000000 00000000 00000000 | 40 0 0 0
  00100000 00000000 00000000 00000000 | 32 0 0 0
  00100000 00000000 00000000 00000000 | 32 0 0 0
  00000001 00000000 00000001 00000000 |  1 0 1 0
  00000000 00000000 00000000 00000000
  10000000 00000000 00000000 00000000 | 128  0 0 0
  00010011 00001011 00000000 00000000 |  19 11 0 0
  00010011 00001011 00000000 00000000 |  19 11 0 0
  00000010 00000000 00000000 00000000 |   2  0 0 0
  00000010 00000000 00000000 00000000 |   2  0 0 0

 | Background color (0's):
 |Blue: 64 Green:64 Red: 0   Unused
  01000000 01000000 00000000 00000000

 | Foreground color (1's):
 |Blue:160 Green:150 Red: 0   Unused
  10100000 10010110  00000000 00000000

| Bit map:
01111111111111000011111111111110
10111111111111000011111111111101
11011111111111111111111111111011
11101111111111111111111111110111
11110111111111111111111111101111
11111011111111111111111111011111
11111101111111111111111110111111
11111110111111111111111101111111
11111111100000000000000111111111
11111111010000000000001011111111
11111111001000000000010011111111
11111111000100000000100011111111
11111111000010000001000011111111
11111111000001000010000011111111
00111111000000111100000011111100
00111111000000111100000011111100
00111111000000111100000011111100
00111111000000111100000011111100
11111111000001000010000011111111
11111111000010000001000011111111
11111111000100000000100011111111
11111111001000000000010011111111
11111111010000000000001011111111
11111111100000000000000111111111
11111110111111111111111101111111
11111101111111111111111110111111
11111011111111111111111111011111
11110111111111111111111111101111
11101111111111111111111111110111
11011111111111111111111111111011
10111111111111000011111111111101
01111111111111000011111111111110
| end of file: net.fbb

The file net.bmp in two parts: header and bit map.

The header: fb -dn -r .62 -p .6 net.bmp

   [  0   1   2   3   4   5]
00: 066 077 190 000 000 000
06: 000 000 000 000 062 000
12: 000 000 040 000 000 000
18: 032 000 000 000 032 000
24: 000 000 001 000 001 000
30: 000 000 000 000 128 000
36: 000 000 019 011 000 000
42: 019 011 000 000 002 000
48: 000 000 002 000 000 000
54: 064 064 000 000 160 150
60: 000 000

The bit map: fb -blnks -p .4 -r 62 net.bmp

062:01111111111111000011111111111110
066:10111111111111000011111111111101
070:11011111111111111111111111111011
074:11101111111111111111111111110111
078:11110111111111111111111111101111
082:11111011111111111111111111011111
086:11111101111111111111111110111111
090:11111110111111111111111101111111
094:11111111100000000000000111111111
098:11111111010000000000001011111111
102:11111111001000000000010011111111
106:11111111000100000000100011111111
110:11111111000010000001000011111111
114:11111111000001000010000011111111
118:00111111000000111100000011111100
122:00111111000000111100000011111100
126:00111111000000111100000011111100
130:00111111000000111100000011111100
134:11111111000001000010000011111111
138:11111111000010000001000011111111
142:11111111000100000000100011111111
146:11111111001000000000010011111111
150:11111111010000000000001011111111
154:11111111100000000000000111111111
158:11111110111111111111111101111111
162:11111101111111111111111110111111
166:11111011111111111111111111011111
170:11110111111111111111111111101111
174:11101111111111111111111111110111
178:11011111111111111111111111111011
182:10111111111111000011111111111101
186:01111111111111000011111111111110