Skip to content

Tag: gnu

Comments in sed command file

Can I put comments (or something functionally equivalent) into a sed command file? subs.sed Answer Yes, comments can be added to a sed file using #. From the manual page of sed: Command Synopsis … The comment extends until the next newline (or the end of a -e script fragment).

What is the point of “grep -q”

I was reading the grep man page and came across the -q option, which tells grep to “not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected.” I don’t understand why this could be desirable or useful behavior. In a program …

Replace characters on specific location every line

We got an exercise where we have to do certain things with the following text document: It’s all data seperated by a “|”. For this exercise, if the year of the first ascent is empty, I need to replace the “||” with “|unclimbed|” I can’t do it like this: Because …

Attach to a GNU screen and then execute commands

I have seen some similar questions asked but the solutions don’t seem to work in my case. I am trying to SSH into a specific screen instance on a Node machine and then execute some commands My current process is this: On the remote machine I create a screen instance: screen -dmS “my_screen” …

Gnu sort: stray characters in field specification

sort doesn’t seem to like my key specification. Why? From the man page: -k, –key=KEYDEF : sort via a key; KEYDEF gives location and type KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where F is a field number and C a character position in the field; both are origin 1, and the st…