I am using AIX 6.1 ksh shell.
I want to use one liner to do something like this:
cat A_FILE | skip-first-3-bytes-of-the-file
I want to skip the first 3 bytes of the first line; is there a way to do this?
aixkshshelltext processing
I am using AIX 6.1 ksh shell.
I want to use one liner to do something like this:
cat A_FILE | skip-first-3-bytes-of-the-file
I want to skip the first 3 bytes of the first line; is there a way to do this?
Best Answer
Old school — you could use
dd
:The input file is
A_FILE
, the block size is 1 character (byte), skip the first 3 'blocks' (bytes). (With some variants ofdd
such as GNUdd
, you could usebs=1c
here — and alternatives likebs=1k
to read in blocks of 1 kilobyte in other circumstances. Thedd
on AIX does not support this, it seems; the BSD (macOS Sierra) variant doesn't supportc
but does supportk
,m
,g
, etc.)There are other ways to achieve the same result, too:
This works if there are 3 or more characters on the first line.
And you could use Perl, Python and so on too.