Quantcast
Channel: sed – Securitron Linux blog.
Browsing all 17 articles
Browse latest View live

Converting a comma delimited file to newline delimited. Using sed to perform...

The search and replace dialog in Gedit. I have used this to convert a comma delimited file to a newline delimited file. I had saved a huge long list of IP addresses that I had to put into the banlist...

View Article



How to use the sed command to filter text files in Linux and other useful...

Using sed to filter a text file and change a specific character for another. In this case the ” character becomes the ‘ character using the magic of the sed command. Since I am using a character the...

View Article

How to filter text with the sed command. This is useful for various shell...

This is a standard listing of files with wildcards in the bash shell. homer@deep-thought ~/Documents $ ls *.wad basenew.wad cc4-tex.wad city-heat.wad dark.wad doom.wad plutonia.wad scythe2.wad...

View Article

How to strip all of the text out of a text file and leave only the numbers...

This is how to remove all text from the output of a file and only keep the other formatting. homer@deep-thought ~/Desktop/b $ fortune -l | sed s/[a-z]/\ /gi; : 3:15 . . - . , ! -- '84 A possibly...

View Article

How to search and replace text in a file with sed. Not using cat.

The sed command is very useful for searching and replacing text in a file. This is how to search for and replace a text string in a file. Homer@bejiitas ~ $ sed -i 's/<main>/<mein>/gi;'...

View Article


Basic text filtering with sed. Very useful when you are manipulating text files.

This example uses sed to replace the beginning word of a sentence. Administrator@WIN-EM8GK0ROU41 ~ $ echo "this is a line of text." | sed "s/this/This/gi;" This is a line of text. This is a better way...

View Article

Useful shell tips. How to search and replace characters or words with the...

Search and replace on the bash shell is very useful for various one-liner shell commands. The below example shows how to replace a # character with a * character....

View Article

Some awesome tricks with awk, grep and sed.

Reading a large text file and then finding all words that contain between 5 and 7 vowels. Notice I am not using cat. jason@Yog-Sothoth:~/Documents$ egrep '^([^aieou]*[aieou]){5,7}[^aieou]*$' Read More →

View Article


Very cool Linux text processing tricks.

Align all text right on an 80 column width. jason@jason-Lenovo-H50-55:~/Documents$ ls -hula | sed -e :a -e 's/^.\{1,80\}$/ &/;ta' total 872K drwxr-xr-x 2 jason jason 4.0K May 4 08:48 . drwxr-xr-x...

View Article


Another way to get the actual IP address of your machine.

This is yet another way to get the actual IP address of your Linux machine on a LAN. This returns just the IP address of your Linux computer. jason@jason-Lenovo-H50-55:~$ ip a | awk '/inet / { print $2...

View Article

Use sed to filter text, this is very useful.

This sed sample will filter out all HTML opening and closing tags in HTML sed -e 's/]*>//g' blog.txt This is an example of the usage of this one-liner. 4.4 Sun Nov 11 jason@Yog-Sothoth 0: $ sed -e...

View Article

Search and replace text in a file with ed.

I have a text file containing this string. deusexmachina:Documents jason$ cat out Darwin deusexmachina.local 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018;...

View Article

Fun with sed on Linux.

The sed command can be used to reverse text. This is a very interesting feature. Provide a text string, and it will be reversed. jason@jason-Virtual-Machine:~$ sed...

View Article


Trim multiple spaces with sed into a normal string.

To trim multiple spaces from a sentence and turn it back into properly readable text, use this sed syntax. sed 's/ \+/ /g' This is an example. echo "Hello, this sentence has multiple spaces in it and...

View Article

Convert text from comma delimited to newline delimited with a simple command.

Some text files are shipped as comma-delimited files. This can be annoying to fix, but it can be done with the Linux command line. Here is an example of comma-delimited text....

View Article


Easily change files on your Linux system with a simple command.

This command will change the default port for the SSH server on your Linux machine. jason@jason-desktop:~$ perl -pi -e 's/^#?Port 22$/Port 443/' /etc/ssh/sshd_config Then run this command to restart...

View Article

More very useful sed tips for the command line on Linux.

More useful sed tips.

View Article

Browsing all 17 articles
Browse latest View live




Latest Images