Tutorial by Examples

pat='[^0-9]+([0-9]+)' s='I am a string with some digits 1024' [[ $s =~ $pat ]] # $pat must be unquoted echo "${BASH_REMATCH[0]}" echo "${BASH_REMATCH[1]}" Output: I am a string with some digits 1024 1024 Instead of assigning the regex to a variable ($pat) we could als...
A simple example which provides the options: OptAlt. OptDetails-h--helpShow help-v--versionShow version info-dr path--doc-root pathAn option which takes a secondary parameter (a path)-i--installA boolean option (true/false)-*--Invalid option #!/bin/bash dr='' install=false skip=false for op ...
a='I am a simple string with digits 1234' pat='(.*) ([0-9]+)' [[ "$a" =~ $pat ]] echo "${BASH_REMATCH[0]}" echo "${BASH_REMATCH[1]}" echo "${BASH_REMATCH[2]}" Output: I am a simple string with digits 1234 I am a simple string with digits 1234
This counts the number of lines in a big file with wc -l while simultaneously compressing it with gzip. Both run concurrently. tee >(wc -l >&2) < bigfile | gzip > bigfile.gz Normally tee writes its input to one or more files (and stdout). We can write to commands instead of fil...
The following function reads an entire file into a new string and returns it: (defun read-file (infile) (with-open-file (instream infile :direction :input :if-does-not-exist nil) (when instream (let ((string (make-string (file-length instream)))) (read-sequence string instr...
Class Car ... ' Parameterless Constructor Public Sub Class_Initialize() distances_ = Array(0) End Sub ' Default initialization method that can be invoked without ' explicitly using the method name. Public Default Function Init(wheels) wheels_ = ...
Quotes will be output as-is: echo "Some Text" "Some Text" Comment tokens are ignored: echo Hello World REM this is not a comment because it is being echoed! Hello World REM this is not a comment because it is being echoed! However, echo will still output var...
SET TEST=0 IF %TEST% == 0 ( echo TEST FAILED ) ELSE IF %TEST% == 1 ( echo TEST PASSED ) ELSE ( echo TEST INVALID )
FIND command can scan large files line-by-line to find a certain string. It doesn't support wildcards in the search string. find /i "Completed" "%userprofile%\Downloads\*.log" >> %targetdir%\tested.log TYPE scan2.txt | FIND "Failed" /c && echo Scan fai...
The following script shows more advanced split file technique, where FOR function loops through a list of files in a directory, and each file content is piped to FINDSTR that looks for a string containing substring var preceded by undefined number of spaces and superseded by any extra text. Once fou...
Basic Syntax Julia's array comprehensions use the following syntax: [expression for element = iterable] Note that as with for loops, all of =, in, and ∈ are accepted for the comprehension. This is roughly equivalent to creating an empty array and using a for loop to push! items to it. result ...
Configuring the Primary Server Requirements: Replication User for replication activities Directory to store the WAL archives Create Replication user createuser -U postgres replication -P -c 5 --replication + option -P will prompt you for new password + option -c is for max...
To download NetBeans IDE just visit the NetBeans site and download the proper version of the IDE based on your OS, Architecture and technologies. You can select from the following technologies: Java SE. Supports all standard Java SE development features as well as support for NetBeans Platform ...
This example renders justified text. It adds extra functionality to the CanvasRenderingContext2D by extending its prototype or as a global object justifiedText (optional see Note A). Example rendering. Code to render this image is in the usage examples at the bottom. The Example The functi...
Renders text as justified paragraphs. REQUIRES the example Justified text Example render Top paragraph has setting.compact = true and bottom false and line spacing is 1.2 rather than the default 1.5. Rendered by code usage example bottom of this example. Example code // Requires justified...
When we’re first starting our work, we have to decide if this is a separate area of work we’re working on, or is this part of an existing line of work. If it’s existing, we can work off of that branch. If it’s new, we’ll start a new branch. Our workflow then is: hg branch MyNewFeature work wo...
Detailed instructions on getting embedded-linux set up or installed. ARM Versatile Express Emulation On Qemu Environment Introduction: Host ubuntu :- 12.04 Linux kernel version: linux-4.4 busybox version: 1.24.0 Cross compiler tool chain: arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux gnu...
Enumeration types can also be declared without giving them a name: enum { buffersize = 256, }; static unsigned char buffer [buffersize] = { 0 }; This enables us to define compile time constants of type int that can as in this example be used as array length.
Setup An Electron project structure usually looks like this: hello-world-app/ ├── package.json ├── index.js └── index.html Now let's create the files and initialize our package.json. $ mkdir hello-world-app && cd hello-world-app $ touch index.js $ touch index.html $ npm init N...
These two properties work in a similar fashion as the overflow property and accept the same values. The overflow-x parameter works only on the x or left-to-right axis. The overflow-y works on the y or top-to-bottom axis. HTML <div id="div-x"> If this div is too small to displa...

Page 764 of 1336