Skip to main content

sed(stream editor) command in Linux/Unix

Introduction to stream editor

A stream editor is a tool that transforms text, edit a file and replaces file content with the manipulation using the regular expression.

Why I used Stream Editor?

I find this tool handy and more useful when I have to change a word of a file line by line. I faced this issue while updating my Debian operating system from Jessie "Debian 8" to stretch "Debian 9" for that, I have to update my /etc/apt/sources.list file, in which I have to change the each "Jessie" word in that file  to "stretch"
So, I use this command

sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list

Here the "s" specifies the substitution. The "/" are delimiters.
"jessie" is the search pattern and "stretch" is the replacement pattern.
 for more refer to sed manual page here or prefer manual page in your machine for sed commands.

Comments

Popular posts from this blog

Big Oh notation and Algorithmic Complexity analysis

Introduction When executing a particular task using algorithms, one common thing that hits every problem solver brain is the efficient and fast algorithm to solve that problem. But, what do exactly fast and efficient means? Is it the measure of real processing time? No, it's not the measure of real time like second and minutes because the old computer with Pentium processor may take a long time to process the same algorithm than the new Intel i3 processor, or, A bad algorithm written in Assembly may execute faster than a good algorithm written in python. So, run time of program can't be considered to measure algorithmic efficiency.  Hence, to measure the algorithmic efficiency, the concept of Asymptotic Complexity of a program and a notation for describing this called Big Oh  was introduced. Big Oh is the worst case, Big Omega and Big Theta are best and average case notations. Worst case means we are mostly unlucky for that problem domain , i.e precondition of task do

Going Through MNIST(Mixed National Institute of Standards and Technology) Datasets in TensorFlow

MNIST Talking About MNIST(Mixed National Institute of Standards and Technology), It is the larger database of the handwritten digit which is used to train and test various Machine learning and Image processing task. [MNIST Wikipedia entry] As a beginner to Machine learning and equally beginner to TensorFlow, I have decided to go through the first tutorial entitled   MNIST For ML Beginners  (Mixed National Institute of Standards and Technology) [In Tensorflow tutorials,  make sure to use the your version of mnist_softmax.py by selecting version in branch section, Do not use master branch because the tutorial will be of different tensorflow version ] for tensorflow 0.11 mnist_softmax.py file ] I started my development environment on Pycharm IDE with interpreter location at virtual environment tensorflow which I created previously during Installation of TensorFlow.  Going through Tutorials The data hosted on yann.lecun.com  is automatically downloaded and read. This is all

Getting Started With Tensorflow

TensorFlow Introduction It is an open source library for machine learning. It was developed at Google by Google brain team. For more info regarding Tensorflow check the Wikipedia entry . Getting Started with Installation Referring to GitHub  link  and choosing the virtual environment Installation Procedure. Following this link  here  for installation procedure of Tensorflow library  CPU version. We can choose any version listed along with CPU/GPU version. After activating the python virtual environment as listed on installation manual console of our environment will be changed like this as in the picture below. Console window changed with (tensorflow) at beginning.  After this steps below, export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl pip install --upgrade $TF_BINARY_URL Faced a problem during installation with this message in console. tensorflow-0.11.0-cp27-none-linux_x86_64.whl is no