To run Sed to Screen's clipboard in Screen's command-mode - gnu-screen

I have a copy in Screen's clipboard which contains the word Masi aften.
I would like to replace it with Bond effectively such that I edit the clipboard directly in Screen's command-mode. I know that I could save the clipboard to /tmp and run the replacement there in Vim, but I want to learn Screen.
I run as I have my data in Screen's clipboard
Ctrl-A : sed s/Masi/Bond/ | [Screen's clipboard] /// I do not know how to refer to Screen's clipboard by a command other that C-A ]
I get
unknown command sed
How can you run a command to Screen's clipboard in Screen's command mode?

I don't think screen has any way of running commands on the paste buffer.
One way to do it is to make a bind to save the paste buffer and open a new window in screen that runs a script to modify the buffer. Then make another bind to reload the modified buffer from disk and paste (this can be bound over the normal paste bind).
Add this to screenrc (changing paths):
bind -c screensed s eval "writebuf /pathtoscript/screensed.clipboard" "screen sh /pathtoscript/screensed.sh"
bind -c screensed p eval "readbuf /pathtoscript/screensed.clipboard" "paste ."
bind , command -c screensed
Make a shell script somewhere:
#!/usr/bin/env sh
echo "Enter sed script: "
read sedcommand
sed -i ${sedcommand} /pathtoscript/screensed.clipboard
echo "(Enter to return)"
read something
"ctrl-a , s" in screen will dump the clipboard and make a new window for the sed command to be entered. "ctrl-a , p" will read the clipboard and paste. The pause at the end of the script is to show any errors sed might give.

Related

Shorten a text into one word in Jira

I summarize a lot of data in Jira often, and need to provide a CML (command line) to each line in the table I create.
The CML is long, meaningless, has spaces in it and is only used to copy-paste into a Linux shell for running a script.
What I do today is write up a table in the description and then open a comment and repeat every line with a CML below it. Primitive....
I would like to add to the table in the description a one word link that when clicked on, copies the text to the clipboard.
I converted the CML into a link by doing this: [OneWord|#CML]] and indeed the long CML was replaced with OneWord.
I hoped that when I right-clicked on it and selected "Copy link address" it would copy the CML to the clipboard.
What actually happend is that it copied to the clipboard also the Jira URL and replaces every space with %20.
So for example if the CML is:
abc -j xyz -c efg.jp
What i get is:
https://jira.blabla/blabla/bla#abc%20-j%20xyz%20-c%20efg.jp
I would appreciate any help possible.

Can't make gnome-screenshot to copy selected area to clipboard on Fedora 32

I want to be able to screenshot selected area and copy it to clipboard.
I try:
gnome-screenshot -a -c
It lets me select the area, but afterwards nothing is copied to clipboard.
I'm using Fedora 32

How do I set WSL console to print tabs instead of spaces (and copy tabs)?

Printing anything with a tab in WSL prints a series of spaces instead of a tab. When I want to copy and paste these lines, obviously spaces are copied, so I lose a lot of formatting.
I've tried using CMD.exe, PowerShell, and MobaXTerm, but in every case I can't seem to print a tab.
echo -e "Col1\tCol2\tCol3 and spaces"
I expect that tab characters should be output and copyable, but the tabs are converted to spaces. Gnome-Terminal in Ubuntu handles this just fine, but every option in Windows 10 / WSL seems to fail.

ImageJ macro that can select "no" when prompted with "Process Stack?"

I have an imageJ macro that involves drawing a line on one slice of a stack. This works great but the only thing that slows this down is the prompt "Process all ### images? There is no Undo if you select 'Yes'."
Is there a way for me to have the macro automatically select "No" when this prompt appears?
Thanks
You can prevent the "Process stack?" dialog by running the Draw command with an option string containing a single space:
run("Draw", " ");
This will only draw on the current slice. If you instead want to draw on the whole stack, you can use:
run("Draw", "stack");
EDIT:
The bug causing incorrect macro recording (run("Draw");) when using the D shortcut was fixed in a recent commit: it now records run("Draw", "slice");

gEdit External Tools Output

I'm new to these forums, so I'm sorry if I've not put this in the correct place or followed forum rules.
I am writing a gEdit External Tools shell script.
In the 'Manage External Tools' dialogue box there is a drop down menu to choose the output.
These options are:
Nothing
Display in bottom pane
Create new document
Append to current document
Replace current document
Replace current selection
Insert at cursor position
So the script can only use one of these.
I want to be able to choose the output from the script. Is there an output variable that can be set in the script? Is what I want even possible?
I've scoured the web for a solution, but to no avail, so I've come here for help.
Thank-you in advance.
It depends on exactly what you want to do, but you definitely have some options:
Inside your script, you can use > /dev/stderr to redirect output to stderr -- that will make it appear in the "Shell Output" pane. In one script of mine that is set to "replace current document" I also write to the Shell Output pane with echo "Something something" > /dev/stderr
You can overwrite the current document the same way: echo "Something something" > $GEDIT_CURRENT_DOCUMENT_NAME will replace the current document with "Something something"
And you can append to current document with >> eg. echo "Something something" >> $GEDIT_CURRENT_DOCUMENT_NAME will add "Something something" to the end of the current document.