Reputation: 35
I'm trying to run a command like:
gunzip -dc file.gz | tail +5c
So this will output the binary file contents minus the first 4 bytes to stdout, and it works. Now I need to append 3 extra bytes to the end of the stream, but only using stdout, never a file.
Imagine the file contains:
1234567890
With the current command, I get:
567890
But I need:
567890000
So... any idea?
Upvotes: 0
Views: 172
Reputation: 35
Ok, so based on the answers, the final solution was:
gzcat file.gz | tail -c +5 | echo 000
I didn't need to, and actually shouldn't, use the tr -d '\n'
, as it will remove the newlines in the middle of the file.
Upvotes: 0
Reputation: 1908
May something like
$ echo "`gunzip -dc file.gz | tail +5c`BBB"
(where BBB are your three extra bytes) work for you?
Upvotes: -1
Reputation: 2396
Try this :
{ gunzip -dc file.gz | tail -c 5 | tr -d '\n'; echo 000; }
Upvotes: 3