0

I have a hexdump output that looks like this

0101f10   64534   64943   00568   00262   01077   00721   00297   00140
0101f20   00748   00288   02211   01124   02533   01271   02451   00997
0101f30   03056   01248   02894   01026   02397   00696   00646   65114
0101f40   00943   64707   01113   64179   01135   64179   00805   64109
0101f50   00514   64045   64654   63037   63026   62014   62173   61625

I want to remove the first column, but I don't know what delimiter has been used by the hexdump command. I tried with awk and cut, but cant figure it out. Any help is appreciated.

Output I want is

64534   64943   00568   00262   01077   00721   00297   00140
00748   00288   02211   01124   02533   01271   02451   00997
03056   01248   02894   01026   02397   00696   00646   65114
00943   64707   01113   64179   01135   64179   00805   64109
00514   64045   64654   63037   63026   62014   62173   61625

5 Answers5

1

With sed

sed 's/[^[:blank:]]*[[:blank:]]*//' infile

With gnu sed

sed 's/\S*\s*//' infile
ctac_
  • 2,413
  • 2
  • 7
  • 17
0
input... | sed -E $'s/ +/\t/g' | cut -f2-

(Assuming Bash for $'\t', but GNU sed supports \t directly anyway.)

n.caillou
  • 1,263
  • 11
  • 15
0
hexdump /path/to/file |  awk '{sub(/[^ ]+ /, ""); print $0}'

This will do the job.

Mohammad Razeghi
  • 1,574
  • 2
  • 14
  • 33
0

If the the delimiter is really a bunch of space, use tr to squeeze-repeats (-s) of psace to a tab and use cut for getting rid of the first column:

$ cat file | tr -s ' ' '\t' | cut -f 2-
64534   64943   00568   00262   01077   00721   00297   00140
00748   00288   02211   01124   02533   01271   02451   00997
03056   01248   02894   01026   02397   00696   00646   65114
00943   64707   01113   64179   01135   64179   00805   64109
00514   64045   64654   63037   63026   62014   62173   61625
James Brown
  • 36,089
  • 7
  • 43
  • 59
0

All solution above works fine, Just adding an awk solution.

So, you only need to omit first column, but get the rest of it, you can try this :

awk '{$1=""; print $0}' /path/to/hexfile

It works perfectly, except that it leaves a space at beginning of each line. If that bothers you, there is a workaround using the substr() function in awk itself.

awk '{$1=""; print substr($0,2)}' /path/to/hexfile

To see more possible ways to do it, follow this link

C0deDaedalus
  • 361
  • 1
  • 4
  • 19