Is there a command like cat in linux which can return a specified quantity of characters from a file?
e.g., I have a text file like:
Hello world this is the second line this is the third line
And I want something that would return the first 5 characters, which would be ‘hello’.
thanks
headworks too:..will extract the first 100 bytes and return them.
What’s nice about using
headfor this is that the syntax fortailmatches:You can combine these to get ranges of bytes. For example, to get the second 100 bytes from a file, read the first 200 with
headand usetailto get the last 100: