escaping newlines in sed replacement string
Looks like you are on BSD or Solaris. Try this: [jaypal:~/Temp] echo ‘abc’ | sed ‘s/b/\ > /’ a c Add a black slash and hit enter and complete your sed statement.
Looks like you are on BSD or Solaris. Try this: [jaypal:~/Temp] echo ‘abc’ | sed ‘s/b/\ > /’ a c Add a black slash and hit enter and complete your sed statement.
Redefine YY_INPUT. Here’s a working example, compile and run with the commands yacc -d parser.y lex lexer.l gcc -o myparser *.c Input is read from globalInputText. You can modify this example so that global input text is whatever string you want or from any input source you want. parser.y: %{ #include <stdio.h> extern void yyerror(char* … Read more
You’re using S_ISREG() and S_ISDIR() correctly, you’re just using them on the wrong thing. In your while((dit = readdir(dip)) != NULL) loop in main, you’re calling stat on currentPath over and over again without changing currentPath: if(stat(currentPath, &statbuf) == -1) { perror(“stat”); return errno; } Shouldn’t you be appending a slash and dit->d_name to currentPath … Read more
if you have GNU date and i understood you correctly $ date +%Y:%m:%d -d “yesterday” 2009:11:09 or $ date +%Y:%m:%d -d “1 day ago” 2009:11:09
Tcl has a good free-form date scanner, if you have Tcl installed (try which tclsh). A shell function: tcldate() { d=${1:-now} # the date string f=${2:-%c} # the output format echo “puts [clock format [clock scan {$d}] -format {$f}]” | tclsh } In action on an ancient Solaris 8 box with bash 2.03 and tcl … Read more
The python2.7 package is dependent to the libssl1_0_0 package (openssl_1.0 runtime librairies). I installed it, and added the /usr/local/ssl/lib directory in $LD_LIBRARY_PATH environnent variable. And now it works perfectly! 🙂
It isn’t exactly the same as sed -i, but i had a similar issue. You can do this using perl: perl -pi -e ‘s/find/replace/g’ file doing the copy/move only works for single files. if you want to replace some text across every file in a directory and sub-directories, you need something which does it in … Read more
As pointed by B. Rhodes, nc (netcat) will do the job. A more compact way to use it: nc -z <host> <port> That way nc will only check if the port is open, exiting with 0 on success, 1 on failure. For a quick interactive check (with a 5 seconds timeout): nc -z -v -w5 … Read more
The -i option streams the edited content into a new file and then renames it behind the scenes, anyway. Example: sed -i ‘s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g’ filename while on macOS you need: sed -i ” ‘s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g’ filename