Reputation: 1
I need to pull out a specific section of the clipboard data.
Characters 235 - 242 are all I need and anything before or after that isn't needed.
I'm using xsel
to retrieve the clipboard data, but how can I trim this to only those characters?
I'm a newbie so I don't know what command-line tools can achieve this.
Upvotes: 0
Views: 20
Reputation: 30951
You can use the cut
utility to extract a substring. This is normally a line-oriented command, but we can change it to use a null character as line separator with the -z
option. Assuming you don't have any nulls in your clipboard text, that will make it index into the full content.
xsel --clipboard | cut -z -c235-242
Upvotes: 0