sed is great for pattern matching or retrieving lines

sed is great for pattern matching or retrieving lines

Here is a cool example

Say you type df:

The output would be something like:

[quote:3bb8d51437]Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hda2 1712432 1206664 418780 75% /
/dev/hda1 31201 10505 19085 36% /boot
none 30932 0 30932 0% /dev/shm

Say you want the second line only you could pipe the output of df to sed
(replace the 2 in '2p' to retrieve a different line)

[code:1:3bb8d51437] df | sed -n '2p'[/code:1:3bb8d51437]

This will return only the second line:

[quote:3bb8d51437]/dev/hda2 1712432 1206664 418780 75% /[/quote:3bb8d51437]

As you can see sed can be very powerful and this is just the beginning of what it can do


sed, matching, retrieving, linessed, lineshere, df, output, bb, filesystem, mounted, dev, hda, shm, retrieve,

Latest Articles

  • ADATA USB Thumb Drive Issues
  • KMODE EXCEPTION NOT HANDLED - QEMU/KVM Won't Boot Windows 2016 or 10 Image or Physical Machine
  • Linux Mint / Ubuntu / Debian Mate Disable Guest Session and Hide Usernames on Lightdm Login screen GUI
  • SSH How To Create Public/Private Key Pair and with a Larger Keysize than 2048 bits
  • selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service geckodriver
  • python ModuleNotFoundError: No module named 'bs4' even though you have the module
  • ssh how to connect using a SOCKS 5 proxy with nc and proxycommand
  • Enable AMDGPU Linux Driver
  • apache symlinks denied even with followsymlinks
  • chown how to change ownership on a symlink
  • how to use ifplugd in Linux to execute a command or script when a NIC cable is unplugged or plugged in
  • dd how to backup and restore disk images including compression with gzip
  • mpv / mplayer with Radeon / AMD GPU Video Card Driver enable VDPAU GPU Accelerated Video Decoding
  • Wordpress Reset Blog User Password from MySQL Using Linux Bash and not PHPMyadmin
  • Ubuntu Linux Mint Debian xorg performance and tear-free tuning for AMD Radeon Based Cards
  • Centos 7 Stopped and Disabled Firewalld and ports still blocked
  • MariaDB / MySQL Reset Root Forgotten Password on Centos 7
  • Centos 7 How to install Mysql/Mariadb
  • PHP 7.2, Apache and Centos 7 How To Install
  • Ubuntu Debian Linux Mint r8169 r8168 Network Driver Problem and Solution