VI Editor - question for unix gurus !!

I have created a dummy file -demo.txt

On my machine-A (oslevel-5300-08) I can display the file content in HEX format through VI editor using :%!xxd but on other machine-B (oslevel - 5300-06) , I get error as "sh: xxd: not found."

machine-A:
$ cat demo.txt
Hello World !

I can display the file content in HEX format through VI editor using :%!xxd

$ vi demo.txt
"demo.txt" 1 line, 14 characters
0000000: 4865 6c6c 6f20 576f 726c 6420 210a Hello World !.

machine-B
sh: xxd: not found.

can anyone tell me what is problem and how to fix this?

Your problem is that xxd isn't a built-in of vi(m), but an external program, which is invoked by vi(m) as a filter (that the :%! part)

Either you installed it seperately on machine-A OR it isn't in the path on machine-B OR someone accidentally deleted it on machine-B

Thanks for your reply....

definitely...these are NOT the cases...

  • Either you installed it seperately on machine-A
  • someone accidentally deleted it on machine-B

How can I check that?
"it isn't in the path on machine-B"

First, you should check to see if xxd exists on the machine(s) and then adjust your PATH accordingly.

How I should check if xxd exists on the machine(s)? cmd?

You can use the find command.

yep, there is diff....

$ which xxd
/@sys/nosupp/bin/xxd

# which xxd
which: 0652-141 There is no xxd in /usr/bin /etc /usr/sbin /usr/ucb /usr/bin/X11 /sbin /usr/java14/jre/bin /usr/java14/bin /usr/local/bin /bin.

so how and from I can install xxd? if you can give some details it will b gr8.

Check if the xxd exists on machine B in the same location:

# ls -l /@sys/nosupp/bin/xxd

If yes, add "/@sys/nosupp/bin" to the PATH variable in .profile of the user on machine B. Currently this directory is not part of PATH (based on the output you pasted).

If no, you need to copy xxd to machine B (assuming its statically linked exe) or install it.

You can also try to do a full blown recursive search for xxd on machine B (better to do this as root as other users may not have read perms on all directories:

find / -name xxd -print 2>/dev/null