REF: http://www.grymoire.com/Unix/Sed.html
$echo day | sed s/day/night/
Output: night
$echo Sunday | sed 's/day/night/'
Output: Sunnight
slash/underscore/colon as a delimiter
---------------
$echo "/home/fawad/sed" | sed 's/\/home\/fawad\/sed/\/home\/nazir\/fawad/'
Output: /home/nazir/fawad
$echo "/home/fawad/sed" | sed 's_/home/fawad/sed_/home/nazir/fawad_'
Output: /home/nazir/fawad
$echo "/home/fawad/sed" | sed 's:/home/fawad/sed:/home/nazir/fawad:'
Output: /home/nazir/fawad
Using & as the matched string
-----------------------
$echo "123 Fawad Nazir" | sed 's/F[a-z]*/(&)/'
Output: 123 (Fawad) Nazir
The values is saved in &. So now you can use it in different ways...
$echo "123 Fawad Nazir" | sed 's/F[a-z]*/(&) [&] _&_ *&*/'
Output: 123 (Fawad) [Fawad] _Fawad_ *Fawad* Nazir
Fun: Only Print a and nothing else
$echo "Fawad Nazir Is a Great Man hahahaha" | sed s/[^a]/\ /g
Output: a a a a a a a a a a
Subscribe to:
Post Comments (Atom)
Azure OpenAI Architecture Patterns & Deployment Patterns
Sharing some useful links that will help customers architect Azure OpenAI solution using the best practices: (1) Azure OpenAI Landing Zone r...
-
Setting up a MPI cluster on Ubuntu involves the following steps: 1. Install OpenMPI on all machines. $sudo apt-get install libopenmpi-de...
-
Very Useful Link: http://people.cc.ku.edu/~grobe/intro-to-LSL/index.html#particle Using the Linden Script Language This page is a short...
-
float p_size = 0.1; default { state_entry() { llSay(0, "Hello, Avatar!"); llSetPrimitiveParams( [ PRIM_...
No comments:
Post a Comment