Grep for literal strings
You can use grep for that, with the -F option. -F, –fixed-strings PATTERN is a set of newline-separated fixed strings
You can use grep for that, with the -F option. -F, –fixed-strings PATTERN is a set of newline-separated fixed strings
I’ll have a go at this. To delete 5 lines after a pattern (including the line with the pattern): sed -e ‘/pattern/,+5d’ file.txt To delete 5 lines after a pattern (excluding the line with the pattern): sed -e ‘/pattern/{n;N;N;N;N;d}’ file.txt
True. But it also means that anyone talking to you knows that you must have to root privileges to run that server. When you log in to a server on port 22 (say), you know you’re talking to a process that was run by root (security problems aside), so you trust it with your password … Read more
paste -d ‘\n’ file1 file2
ts from moreutils will prepend a timestamp to every line of input you give it. You can format it using strftime too. $ echo ‘foo bar baz’ | ts Mar 21 18:07:28 foo bar baz $ echo ‘blah blah blah’ | ts ‘%F %T’ 2012-03-21 18:07:30 blah blah blah $ To install it: sudo apt-get … Read more
A typical BFD-ld or Gold linked Linux executable has 2 loadable segments, with the ELF header merged with .text and .rodata into the first RE segment, and .data, .bss and other writable sections merged into the second RW segment. Here is the typical section to segment mapping: $ echo “int foo; int main() { return … Read more
Your best bet is to try sending the file descriptor over a Unix domain socket. This is described in Stephens, and in a few places on the web, but I can dig up code for you if you ask nicely. This will be pretty portable these days; a lot of the things considered “non-portable” way … Read more
If you’re using a shell that does simple substitution and the SHELL_VAR variable does not exist (or is blank), then you need to watch out for the edge cases. The following translations will happen: if test $SHELL_VAR = yes; then –> if test = yes; then if test x$SHELL_VAR = xyes; then –> if test … Read more
Use: grep — -X Documentation Related: What does a bare double dash mean? (thanks to nutty about natty).
Underneath the file system, files are represented by inodes. (Or is it multiple inodes? Not sure.) A file in the file system is basically a link to an inode. A hard link, then, just creates another file with a link to the same underlying inode. When you delete a file, it removes one link to … Read more