Remove null byte from bplist output

The output from bplist terminate each line with a null byte . This null byte is not direct visible on the console, but may show  as a ^@. Also a od -c (UNIX tool) indicate each line is terminated with \0\n.

Some regular expression will not work correctly because of this extra non-visible character. Particular those commands that must match end of line (e.g file extensions).

To resolve the issue use sed to strip off the null byte:

/usr/openv/netbackup/bin/bplist -B -C $CLIENT -R -t 13 / | sed ‘s/\x0//g’

you can also use a perl one liner (much faster)

/usr/openv/netbackup/bin/bplist -B -C $CLIENT -R -t 13 / | perl -pe ‘s/\x0+$//’

Regular expression will now work as intended.

(Visited 240 times, 1 visits today)