Announcing zp! A cli command to copy the contents of the source file or of the std output buffer to the clipboard


zp my_file.txt

To get the first n (n is an integer) words of the file :

zp my_file.txt n

To get the lines between a range, i.e., to get lines from n till m (n and m are integers) of the file:

zp my_file.txt n m 

Also you can use zp to copy from the std output buffer :

cat sample_file.txt | zp 

This copies the entire output of the file.

You can use get a range of lines and the first n words also from the std output buffer :

cat sample_file.txt | zp 2

cat sample_file.txt | zp 2 5

This gets the first 2 words and lines from 2 to 5 of the sample_file.txt respectively.

Check zp out here :


So, one positional argument equates to getting some number of words while two positional arguments mean lines? If I'm understanding it correctly, this seems like confusing and unintuitive behavior.
Maybe consider adding named arguments, like --from and --to for lines and --words for maximum word count?


Hey, thank you for your suggestion. That thought crossed my mind too, but the aim was to keep things really minimal without any flags. Maybe if this is a really big problem, I will definitely incorporate the named arguments!

But is it pronounced zed-pee or zee-pee?

Maybe I should just zip it :wink:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.