Search Results for: sed

Linux: List/Find used inodes in a filesystem

Some times you may come across below error. touch: cannot touch `abc.txt’: No space left on device // using touch. This will be bit annoying when you come to know there is a space left in your desk. The culprit in this case is total number of used inodes. If all your inodes are used away you can not create a file/folder though you have plenty of free space left in your machine. Ok, how can I conform how many inodes I used in my machine? We can use df command to get those details. df -i Output: root@linuxnix:/home#...

Read More

SED: Insert/append data to particular line number

Sed is a powerful tool to do some text manipulations in a file. We already covered some basic SED stuff. https://www.linuxnix.com/2012/04/sedsteam-editor-explained-detail-linuxunix.html In this post we will see one simple use case of SED. I have a requirement where I have to insert a new line with some data at a particular line. We can achieve it with 'i' operator. I have following file and I want to insert a line at 4th line as "This is my 4th line" surendra@sanne-taggle:~/code/sh$ cat ade      August 2015        Su Mo Tu We Th Fr Sa        ...

Read More

SED: Delete a matched line from a file

This is a small post on how to delete a line from a file when it matched some criteria. We can use many tools and languages like sed, awk, grep, python, perl, ruby etc. In this post we specifically use SED which is by default installed in Linux. SED is a powerful tool which is useful for text file modifications. GNU SED have one capability to edit files directly by using -i which is insert. To delete a line from a file use below code sed '/<search-pattern>/d' filename // is used for searching a pattern and 'd' is used...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.